We updated PsychoPy to 1.84.1. Now, when we try to run our experiment, an error message pops up that reads TypeError: not enough arguments for format string. Does anyone know how to fix this? See entire message below:
Note: Dynamic code seems intended but updating is “constant”:
“corrAns”, in Routine trial2 (key_resp_10: Allowedkeys)
Traceback (most recent call last):
File “C:\Users\smoker\Desktop\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.
7.egg\psychopy\app\builder\builder.py”, line 1903, in runFile
script = self.generateScript(self.exp.expPath)
File “C:\Users\smoker\Desktop\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.
7.egg\psychopy\app\builder\builder.py”, line 2091, in generateScript
target=target)
File “C:\Users\smoker\Desktop\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.
7.egg\psychopy\app\builder\experiment.py”, line 206, in writeScript
self.flow.writeBody(script)
File “C:\Users\smoker\Desktop\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.
7.egg\psychopy\app\builder\experiment.py”, line 1472, in writeBody
entry.writeMainCode(script)
File “C:\Users\smoker\Desktop\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.
7.egg\psychopy\app\builder\experiment.py”, line 1662, in writeMainCode
event.writeFrameCode(buff)
File “C:\Users\smoker\Desktop\PsychoPy2\lib\site-packages\psychopy-1.84.1-py2.
7.egg\psychopy\app\builder\components\keyboard_init_.py”, line 167, in writeF
rameCode
allowedKeys)
TypeError: not enough arguments for format string
Now, when I go to open the experiment, it loads like it is going to open but then, Psychopy quickly closes and there is a new error screen. The only words I am able to read before it closes are “cannot support”.
It looks like the original error message is a bug we’ve introduced during recent refactoring. It only affects people specifying variables in the “allowed keys” entry, which I’m guessing you were?
Why it’s now not even loading I don’t know. I’ll upgrade you to Basic (from New) User so you can upload a copy of the experiment file for us to inspect and (hopefully fix)
It appears that the path to the program was interrupted which we were able to correct. I think it may be the same issue for the “allowed keys”, for some reason the program can no longer locate the files that tell it what the correct answers are for the experiment.
Hi - rather than have separate topics, I thought I’d add to this one.
I’m on OSX El Capitan using PsychoPy 1.84.01 and an experiment I made in 1.83.04 is no longer working and is also providing a formatted string related error message:
Welcome to PsychoPy2!
v1.84.1
Traceback (most recent call last):
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/app/builder/builder.py”, line 1903, in runFile
script = self.generateScript(self.exp.expPath)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/app/builder/builder.py”, line 2091, in generateScript
target=target)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/app/builder/experiment.py”, line 206, in writeScript
self.flow.writeBody(script)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/app/builder/experiment.py”, line 1472, in writeBody
entry.writeMainCode(script)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/app/builder/experiment.py”, line 1224, in writeMainCode
self.loop.writeLoopStartCode(buff)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/app/builder/experiment.py”, line 864, in writeLoopStartCode
buff.writeIndentedLines(code % inits)
TypeError: not enough arguments for format string
I’m using formatted strings to select image folders based on input from the dialogue box at runtime.
I have made the modification to the keyboard init.py file but it is not working - has anyone any clues?
I replaced my keyboard init.py file as well. Now, I no longer receive the error message but it still does not allow the participant to get past the part where I have the variable as the allowed keys.
I can’t replicate the problem. With the fixed keyboard/__init__.py file it seems to work for me. Could you either let me know what happens when you run the demo below or send a version that doesn’t work for me to test?
This one was caused by the PEP8 refactoring - making the lines pretty and short meant they didn’t wrok quite the same as before. :-/ That buglet is now fixed in repos