psychopy.org | Reference | Downloads | Github

TypeError: unsupported operand type(s) for /: 'tuple' and 'int'

Hi,

I am currently working on an experiment with a group of people. I created a Psychopy survey in version 1.86.2 on a Windows computer. The survey has a story image presented and after each story image the participant answers 2 questions about the story. The survey works on my computer.

However, on 2 MAC computers using version 1.85.6 the survey does not work and when it runs you are able to get to the image, but then when it goes to the rating scale you get this error message

Running: /Users/andrea/Code/punishment experiment test with correct loop_lastrun.py
pyo version 0.8.6 (uses single precision)
2018-02-02 13:33:54.574 python[5244:366543] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
File “/Users/andrea/Code/punishment experiment test with correct loop_lastrun.py”, line 312, in
win.flip()
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/window.py”, line 646, in flip
thisStim.draw()
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/ratingscale.py”, line 1135, in draw
mouseX, mouseY = self.myMouse.getPos() # norm units
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/event.py”, line 499, in getPos
lastPosPix = lastPosPix - self.win.size / 2
TypeError: unsupported operand type(s) for /: ‘tuple’ and ‘int’

If anyone has any idea how to resolve this issue it would be greatly appreciated!

I’ve encountered the same problem with a visual rating scale while running an experiment on my Mac.
I’m with 4d4c, a solution will be greatly appreciated! :smiley:

Update: I updated Psychopy to version 1.85.6 on my Windows computer and the survey works perfectly. It seems to be that the ratingscale.py files are very different on the Windows and Mac versions. Windows is about 300-400 lines of code while the Mac version is over 1000.

I’ll try on a Windows computer as well. However, this bug is quite puzzling since the previous version of Psychopy was actually supporting ratingscale.py on Mac without problems.

This is to do with the mouse code, not the rating scale. Searching for error messages is a good place to start when looking for help:

Hi Micheal, many thanks for your help and for the linked post.
Actually I forgot to post it before, but I solved the problem some days ago by setting noMouse=True in the rating scale function (not surprisingly since, as you mentioned, the problem is mouse-related) :smiley:
However, even if the problem has been fixed on 1.85.6 for Windows (as @jon reported in the linked discussion), it seems to be still there in the 1.85.6 for Mac. I’ll keep this version for my current experiment since I don’t need the mouse at all, but I’m considering to “downgrade” to 1.85.4 if necessary.