Howdy, Stranger!

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

Supported by

[solved] TypeError: a float is required

edited February 2014 in OpenSesame

Hi

I'm getting a "a float is required typeerror" from a sequence in my experiment. The sequence consists of a Python inline script which randomizes a few elements/images that are displayed in the next sketchpad, and a "pause" sketchpad item that is identical to the first sketchpad except that it's static.

The type error seems to occus at random and I haven't been able to figure out what goes wrong. The output in the debug console isn't too helpful but I'm fairly sure that it's caused in one of the sketchpad objects.

Error message:
An unexpected error occurred, which was not caught by OpenSesame. This should not happen! Message:
a float is required

Debug console output:

Traceback (most recent call last):
  File "dist\libqtopensesame\qtopensesame.py", line 1393, in run_experiment
  File "dist\libopensesame\experiment.py", line 287, in run
  File "dist\libopensesame\sequence.py", line 55, in run
  File "dist\libopensesame\loop.py", line 147, in run
  File "dist\libopensesame\sequence.py", line 55, in run
  File "dist\libopensesame\loop.py", line 147, in run
  File "dist\libopensesame\sequence.py", line 55, in run
  File "dist\libopensesame\loop.py", line 146, in run
  File "dist\libopensesame\sequence.py", line 107, in prepare
  File "dist\libopensesame\sketchpad.py", line 213, in prepare
  File "dist\openexp\_canvas\xpyriment.py", line 314, in image
  File "C:\Program Files (x86)\OpenSesame\expyriment\stimuli\_visual.py", line 1013, in scale
TypeError: a float is required

Regards
Benjamin

Comments

  • edited 8:51PM

    Hi Benjamin,

    The error is a bit ugly, because it's not properly caught by OpenSesame, but essentially it looks like you're trying to use a non-numeric value as the scale of an image element in a sketchpad. For example, this will trigger the error:

    draw image 0 0 "picture.png" scale=i_should_be_numeric
    

    You may also be using a variably defined scale, and have a variable with a non-numeric value. For example:

    draw image 0 0 "picture.png" scale=[logfile]
    

    Does that solve things?

    Cheers,
    Sebastiaan

  • edited 8:51PM

    Looked through all my scale numbers and found small silly typo that made one non-numerical. Haven't encountered the error since I fixed it so that was most definitely the cause.

    Thanks for the support.
    Benjamin

Sign In or Register to comment.