| Reference | Downloads | Github in demos giving TypeError: unsupported operand type(s) for /: 'tuple' and 'int'

Hi all,

I was trying to run in demos section of Psychopy. I am using the recent standalone version of Psychopy on MAC OS sierra.

Can anyone help me to understand why I am getting following error?

Traceback (most recent call last):
  File "/Applications/", line 41, in <module>
    mouse_dX, mouse_dY = myMouse.getRel()
  File "/Applications/", line 655, in getRel
    relPos = self.getPos()
  File "/Applications/", line 558, in getPos
    lastPosPix = lastPosPix - / 2
TypeError: unsupported operand type(s) for /: 'tuple' and 'int'
1.8979 	WARNING 	Monitor specification not found. Creating a temporary one...

Thanks in Advance!

I ran into this error as well. As far as I can tell, it seems to be related to a small bug in the file that deals with calculating the updated mouse position. If you look on line 558 in this file, you’ll see this:

lastPosPix = lastPosPix - / 2

The problem is that here is a tuple, which does not support elementwise division or subtraction. However, lastPosPix is a numpy array, which does support these operations. I fixed this bug by editing this line like so:

lastPosPix = lastPosPix - numpy.array( / 2

That got things working for me. Hope that helps.


Thanks ! It helped :slight_smile:

Yes, this has been fixed in the main release now

Thanks Jon. I was using the previous package of Psychopy. Now it works fine :slight_smile:

The problem is still present in 1.85.6 and 1.85.3 (maybe the bug fix got lost?)

1 Like

I can confirm it’s still there in 1.85.6 ! why ? (the windows bug with the problem of encoding the name of the sound card is still there too !)