Howdy, Stranger!

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

Supported by

Python scripts colliding?

Good afternoon,

I'm so close to having finished my experiment but I've run into another issue. I have two python scripts that were basically carbon copies of each other. The first, gases_question_canvas_test, and the second, legislation_question_cavas_test.

They both contain a set of 10 questions which the user can type their answers into except the legislation questions will present a circle very 10 seconds to put the user off.

They both run fine when they're the only script in the experiment but when they're one after another the experiment doesn't run!

Here's the error

Stopped

The experiment did not finish normally for the following reason:

Error while executing inline script
Details

item-stack: experiment[prepare].legislation_question_canvas_test[prepare]
exception type: TypeError
exception message: 'Xpyriment' object is not callable
item: legislation_question_canvas_test
time: Sat Apr 11 14:03:49 2020
phase: prepare
Traceback (also in debug window)

 File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\inline_script.py", line 92, in prepare
  self.workspace._exec(self.cprepare)
 File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\base_python_workspace.py", line 124, in _exec
  exec(bytecode, self._globals)
 Inline script, line 26, in 


Initially I thought this was to do with a collision of the names, i.e. duplication of global variables and function names so I modified the legislation script to begin each with l_ so as to avoid it but this still happens. What could be the issue here?

I've had to attach the whole experiment rather than just the two scripts.


It's complaining about line 26 of legislation but I don't see what's wrong here.

Any ideas?

Comments

  • Hi,

    It actually has to do with line 26 (and 27 and 28 to be specific). When creating a canvas,mouse or keyboard you have to capitalize the first letter. Or, import the lowercase functions from openexp (e.g. from openexp import canvas). After I changed that, your experiment seems to work.

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.