inline script: understanding Traceback
I have "borrowed" an OS script with a fair amount of inline python from a collaborator. At the moment, the script fails to run:
Details
item-stack: experiment[run].practice_loop[run].practice_sequence[run].practice[run]
exception type: TypeError
exception message: float() argument must be a string or a number
item: practice
time: Fri Jun 22 11:14:39 2018
phase: runTraceback (also in debug window)
File "/usr/lib/python2.7/site-packages/libopensesame/inline_script.py", line 96, in run
self.experiment.python_workspace._exec(self.crun)
File "/usr/lib/python2.7/site-packages/libopensesame/python_workspace.py", line 174, in _exec
exec(bytecode, self._globals)
Inline script, line 3, in <module>
Inline script, line 184, in display_trial
File "/usr/lib/python2.7/site-packages/openexp/_canvas/canvas.py", line 1223, in image
fname, center=center, x=x, y=y, scale=scale, rotation=rotation
File "/usr/lib/python2.7/site-packages/openexp/_canvas/canvas.py", line 441, in __iadd__
self['stim%d' % self._stimnr] = element
File "/usr/lib/python2.7/site-packages/openexp/_canvas/canvas.py", line 368, in __setitem__
value = value.construct(self)
File "/usr/lib/python2.7/site-packages/openexp/canvas_elements.py", line 37, in construct
return cls(canvas, *self._args, **self._kwargs)
File "/usr/lib/python2.7/site-packages/openexp/_canvas/_image/image.py", line 31, in __init__
scale=scale, rotation=rotation)
File "/usr/lib/python2.7/site-packages/openexp/_canvas/_element/element.py", line 64, in __init__
for prop, val in properties.items()
File "/usr/lib/python2.7/site-packages/openexp/_canvas/_element/element.py", line 332, in _assert_numeric
v = float(v)
TypeError: float() argument must be a string or a number
My question is what relation "line 96" in the traceback has to the inline code in practice[run]. A glance at the code suggests the error can't be there (line 96 just says print dist_image
); if I "view script" then line 94 (print referent
) becomes line 96. Or am I looking in completely the wrong place?
Many thanks
--MC
Comments
Hi MC,
line 96 refers to the source code of Opensesame that implements the behaviour of the
inline_script
. I think, the relevant part of the stack trace that you can find in your code is first of all the line:item-stack: experiment[run].practice_loop[run].practice_sequence[run].practice[run]
, which tells you thatinline_script
that causes the error andInline script, line 3, in <module> Inline script, line 184, in display_trial
, which refer to the line in that code. The way it looks to me there are user-defined functions called in that script. The traceback is so long and rather confusing because the error is quite deep in the libraries.I hope this helps.
Eduard