Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Help Please, code not working

edited July 2014 in OpenSesame

from random import shuffle self.get('initial_list') exp.set('list', initial_list) shuffle(list) exp.set('list2', list[5:]) exp.set('list3', list2[:5]) exp.set('cue', (list3 * 5) + list2[5:]))

receives the following error message -

Error: Inline script error
In: script (prepare phase)
Line: 6

Python traceback:
NameError: name 'initial_list' is not defined

Full traceback in debug window

image

Comments

  • edited 6:43PM

    Hi,

    The problem here is that you are referring to a Python variable (initial_list) that you haven't defined. Simply calling self.get('initial_list') doesn't do anything, as long as you don't assign the return value to a variable. For example like so:

    initial_list = self.get('initial_list')
    exp.set('list',  initial_list)
    

    I would recommend walking through one of the basic Python tutorials. Once you have a basic knowledge of Python, you'll find that using OpenSesame inline_scripts is pretty straightfoward. See:

    Good luck!
    Sebastiaan

  • edited 6:43PM

    Thank you for replying Sebastian, I am doing the tutorials as we speak :). I'm still not sure I can accomplish what I need.

    The problem is I have a list of 15 images, that need shuffling, before 5 are discarded. Of the remaining 10, 5 are replicated by 5, and 5 are left singular, giving a total of 30 images.

    These then need shuffling again before being presented to the participant.

    This cycle is repeated for each participant.

    What we are doing is asking them a series of multiple choice questions before seeing the 30 cue images, and then repeating the questions after they have seen the images, to see if there is any variation in their answers.

    I'll keep working on it :)

Sign In or Register to comment.