psychopy.org | Reference | Downloads | Github

TypeError in Psychopy

Hi,

Can someone please help me with this error.?

Traceback (most recent call last):
  File "speller_auto_test.py", line 38, in <module>
    font='Monospace', pos=(0,-300), height='40', wrapWidth=600
  File "/usr/local/lib/python2.7/site-packages/psychopy/visual/text.py", line 154, in __init__
    self.setHeight(height, log=False)  # calls setFont() at some point
  File "/usr/local/lib/python2.7/site-packages/psychopy/visual/text.py", line 202, in setHeight
    setAttribute(self, 'height', height, log)
  File "/usr/local/lib/python2.7/site-packages/psychopy/tools/attributetools.py", line 137, in setAttribute
    setattr(self, attrib, value)
  File "/usr/local/lib/python2.7/site-packages/psychopy/tools/attributetools.py", line 27, in __set__
    newValue = self.func(obj, value)
  File "/usr/local/lib/python2.7/site-packages/psychopy/visual/text.py", line 194, in height
    units=self.units, win=self.win)[1]
  File "/usr/local/lib/python2.7/site-packages/psychopy/tools/monitorunittools.py", line 82, in convertToPix
    return unit2pixFunc(vertices, pos, win)
  File "/usr/local/lib/python2.7/site-packages/psychopy/tools/monitorunittools.py", line 22, in _pix2pix
    return pos + vertices
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S21') dtype('S21') dtype('S21')

Thanks in Advance!

The parameter height should probably be a numerical value rather than a string of characters (e.g. 40 rather than '40'). That value gets passed on to functions which try to do some maths with it, one of which finds it can’t add numbers to your characters.

Thanks Michael for your help. It is resolved and is working fine now. :slight_smile:

Hi, Could you please help me resolve this error?

Traceback (most recent call last):
  File "real_time_SSVEP_simulation.py", line 16, in <module>
    import pyseeg.modules.ssveplib as slt
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PysEEG-0.0.1-py2.7.egg/pyseeg/modules/ssveplib.py", line 18
    self.x_freq = [i/window_len/(float(fs)/2.)) for i in range(window_len)]
                                              ^
SyntaxError: invalid syntax

Thanks In Advance!

See the little ^ ? It is pointing to an unmatched )

Delete that to make the left and right parentheses match.

Hi Michael, Thanks for your reply. I have already done that and still the same error pops up in the same way.

There seem to be two different threads here discussing the same error.

I mentioned in the other thread that maybe the module was not re-imported after making the change or that the file was not saved before re-importing because the text quoted in the error message does not appear in the provided code snippet.

Allen