Howdy, Stranger!

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

Supported by

[open] Opensesame 3.0 bugs

edited October 2015 in OpenSesame

Hi all

We have just (today) had opensesame added to the open access PC's for use in some tutorials, unfortunately I was hoping for version 2.9.7 but didn't realise that you have changed at the weekend. I had given them a link to the main download page. Now the tutorials aren't able to run, unless I can debug them which I am struggling with due to the following problems.

I am running using the zipped version, as I dont want to install it yet.

If I use a canvas without importing it I get the red arrow (undefined name 'canvas')
If I use canvas witout (exp) I get the following TypeError: canvas() takes at least 1 argument (0 given)

If I make a mistake in a inline script, i.e. defining a variable as global after it has been set e.g. a = 10 global a,then
an error message appears (Oops, I did it again) and I am unable to get back into the inline script, have to go through the Script editor.

Will let you know if I find other issues.

Regards

Gary

Comments

  • edited 10:21AM

    Using the var feature gives me an error message undefined 'var'

  • edited 10:21AM

    Hi Gary,

    Thanks for your feedback.

    If I use a canvas without importing it I get the red arrow (undefined name 'canvas') If I use canvas witout (exp) I get the following TypeError: canvas() takes at least 1 argument (0 given.

    You see the red arrow if 'Validate content' is enabled in the editor component. This is because it validates the scripts by themselves, and does not take into account that you can use symbols from one script in another. This option is disabled by default, exactly to avoid these false alarm.

    In any case, you can safely ignore it. (And validation can even be convenient to catch real errors if you can see past the false alarms.)

    So: no need to import canvas, and no need to pass exp--just as it says in the docs.

    If I make a mistake in a inline script, i.e. defining a variable as global after it has been set e.g. a = 10 global a,then an error message appears (Oops, I did it again) and I am unable to get back into the inline script, have to go through the Script editor.

    Is saw that coming in, yes. This happens when there is a SyntaxWarning, which is triggered very rarely--I wasn't even aware that they existed. So far, the only situation I know of is what you describe: declaring a variable global after assigning to it.

    I actually uploaded a 3.0.1 prerelease where this is fixed, because it is extremely annoying, if rare:

    By the way, you don't need to declare symbols global in most cases:

    Using the var feature gives me an error message undefined 'var'

    What do you mean with 'using the var feature'? var is an object that you can access in inline_script items. After running an experiment, you can access a var object (kind of a shadow of the real one) also from the debug window.

    Cheers,
    Sebastiaan

  • edited 10:21AM

    Hi

    I was trying to update the code with all the new features/methods, in an attempt to debug the code. The main problem turned out to be programmer error, used == in the Run if, but this appears to work in 2.9.x. Would it be possible to have both recognised, programmers want to use == and others =.

    But I did try the following:

    No import of canvas and no need to pass exp.
    Change self.get and exp.set to var.
    And to try to remove all the error indicators, using global etc

    The error with the canvas was caused by importing canvas and not passing exp, it is ok if not imported with or without exp.

    I was slightly under pressure and was trying to work through the errors, so all these red arrows was confusing the matter.

    Regards
    Gary

  • edited 10:21AM

    The main problem turned out to be programmer error, used == in the Run if, but this appears to work in 2.9.x. Would it be possible to have both recognised, programmers want to use == and others =.

    You can use '=' and '==' interchangeably in conditional statements. (Not if you use Python code, of course.) Can you give an example of a conditional statement that doesn't work as expected?

    The error with the canvas was caused by importing canvas and not passing exp, it is ok if not imported with or without exp.

    Yes, I suspected as much. If you do from openexp.canvas import canvas, you overwrite, or shadow, the new canvas function with the old one, so you have pass exp again. So these two scripts are interchangeable (although the second is clearly nicer):

    # The old way
    from openexp.canvas import canvas
    c = canvas(exp)
    

    and

    # OpenSesame >= 3.0.0
    c = canvas()
    
Sign In or Register to comment.