psychopy.org | Reference | Downloads | Github

Experiment failing to run: TypeError

OS (e.g. Win10): Mac 10.14.6
PsychoPy version (e.g. 1.84.x): v2020.1.2
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?: Run experiment

What did you try to make it work?: Restarted PyschoPy/computer. Verified settings (was running fine previously). The only thing that’s changed (in my mind) is I started to try to run online (which didn’t work)

What specifically went wrong when you tried that?:
Experiment did not run at all. Got a TypeError exception:
TypeError: must be real number, not str

4289.1480 DEBUG PsychoPyApp: Showing about dlg
5069.3079 INFO Loaded monitor calibration from [‘2020_06_24 22:06’]
Generating PsychoPy script…

2020-07-09 15:50:07.634 python[28201:212534] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
File “runpy.pyc”, line 193, in _run_module_as_main
File “runpy.pyc”, line 85, in _run_code
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 253, in
compileScript(args.infile, args.version, args.outfile)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 245, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 224, in _makeTarget
script = thisExp.writeScript(outfile, target=targetOutput)
File “/Users/javierjasso/.psychopy3/versions/psychopy/experiment/_experiment.py”, line 206, in writeScript
self_copy.settings.writeWindowCode(script) # create our visual.Window()
File “/Users/javierjasso/.psychopy3/versions/psychopy/experiment/components/settings/init.py”, line 736, in writeWindowCode
requestedScreenNumber = int(self.params[‘Screen’].val)
ValueError: invalid literal for int() with base 10: ‘’

Running: /Users/javierjasso/Desktop/posnerfirst/moodHeritage_lastrun.py

5071.9983 INFO /Applications/PsychoPy3.app/Contents/MacOS/python -m psychopy.scripts.psyexpCompile /Users/javierjasso/Desktop/posnerfirst/moodHeritage.psyexp -o /Users/javierjasso/Desktop/posnerfirst/moodHeritage_lastrun.py -v latest
Error in function GetDevices: Supplied value was either fractional or outside of allowed range.
PsychPortAudio:GetDevices: Usage:

devices = PsychPortAudio(‘GetDevices’ [, devicetype] [, deviceIndex]);
Traceback (most recent call last):
File “/Users/javierjasso/Desktop/posnerfirst/moodHeritage_lastrun.py”, line 24, in
from psychopy import sound, gui, visual, core, data, event, logging, clock
File “/Users/javierjasso/.psychopy3/versions/psychopy/sound/init.py”, line 139, in
elif dev not in backend.getDevices(kind=‘output’):
File “/Users/javierjasso/.psychopy3/versions/psychopy/sound/backend_ptb.py”, line 90, in getDevices
allDevs = audio.get_devices(kind)
File “psychtoolbox/audio.pyc”, line 73, in get_devices
TypeError: must be real number, not str

Experiment ended.

@javjasso, take a look at your Experiment Settings, and the Screen tab. Do you have a string in the ‘Screen’ field? You should have an int giving the screen number e.g., 1.

Yes, that was it :sweat_smile:.
Thank you so much, @dvbridges!