Howdy, Stranger!

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

Supported by

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:


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: run

Traceback (also in debug window)

File "/usr/lib/python2.7/site-packages/libopensesame/", line 96, in run
File "/usr/lib/python2.7/site-packages/libopensesame/", 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/", line 1223, in image
fname, center=center, x=x, y=y, scale=scale, rotation=rotation
File "/usr/lib/python2.7/site-packages/openexp/_canvas/", line 441, in __iadd__
self['stim%d' % self._stimnr] = element
File "/usr/lib/python2.7/site-packages/openexp/_canvas/", line 368, in __setitem__
value = value.construct(self)
File "/usr/lib/python2.7/site-packages/openexp/", line 37, in construct
return cls(canvas, *self._args, **self._kwargs)
File "/usr/lib/python2.7/site-packages/openexp/_canvas/_image/", line 31, in __init__
scale=scale, rotation=rotation)
File "/usr/lib/python2.7/site-packages/openexp/_canvas/_element/", line 64, in __init__
for prop, val in properties.items()
File "/usr/lib/python2.7/site-packages/openexp/_canvas/_element/", 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



  • 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 that inline_script that causes the error and Inline 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.


Sign In or Register to comment.