Failing to update old OS 2.9.7. scripts to OS 3.1+
Hi!
I just wanted to move on from the older Open Sesame version (2.9.7) to the latest version (3.1.) and I figured a good way to start is to check out old scripts that worked flawless on the older OS version and see how they behave on the newest OS.
However, this process does not run very smoothly since I get errors that make little sense to me. For instance:
exception type: TypeError exception message: line() takes exactly 5 arguments (6 given)
...and it refers to this line:
exp.canvas.line(x+d, y, x, y+d, color)
Similarly:
exception type: TypeError exception message: circle() takes exactly 4 arguments (6 given)
referring to line:
exp.display.circle(x, y, size_circle, fill=False, color=stimulus['color'])
Looking in the OS documentation on either the line or circle function tells me that I am using the function correctly.
It is not quite clear what the mistake here can be other than that something has changed from OS 2.9.X to 3.1. Again, I emphasize, running an identical copy of the script in OS 2.9 does not cause any problems.
I am reluctant to start from scratch programming the same experiments by going thru the old code line by line, since some of my scripts are quite dense.
Does anyone have an idea what the problem could be ?
Is there any general change in the workflow of OS experiments, or maybe an overview about all changes in how to handle basic functions (e.g. canvas or inline functions) from the old 2.X compared to the new 3.X OS versions ?
Any help is appreciated! Thanks!
Michel
EDIT:
I should mention that I tested a super-simple version of the same code (i.e. simply drawing a line or circle) using the same style of coding I used in the old scripts with a separate OS 3.1. script. Then I do not receive these errors. So it seems that the code as such is not incorrect. What is happening??
Comments
Hi Michel,
There have been some changes to the API OpenSesame 3, but it should be pretty straightforward to update your script. I actually forgot to include the issue that you're running into here in the list of important changes for v3.
Essentially, you have to use keyword arguments for all style keywords that are listed here. To avoid confusion: a keyword argument is an argument with an explicit name.
So this:
Becomes:
The second error that you mention is probably the same, although the line that you give does not match the error. So a slight mixup there, probably.
As a side note, it is not necessary to attach objects to the
exp
object, or to declare them global:Does that clear things up?
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Sounds like a solution. I will check it out and report back if it does not work -- thanks!
PS: Is there any way to update older posts? I wanted to update the title of this thread to indicate that the problem has been solved, but for some reason I cant modify my earlier post...
You can only edit posts for (I believe) an hour after posting them. This is because spambots tend to first post a harmless message to bypass moderators, and then come back to add spamlinks etc.
In any case, don't worry: we abandoned the system with marking discussions as [solved] because it was too hard to do this consistently.
Check out SigmundAI.eu for our OpenSesame AI assistant!