| Reference | Downloads | Github

TypeError: image is undefined

URL of experiment:

Description of the problem:
My experiment works fine locally, but when I try to run the Psychojs task in debug mode it crashes during the practice. I used participant 1. It appears that Not all resources (here, images) are loaded in the initial screen - sometimes it gets to 180.5, sometimes to 185.5, I presume one image is problematic but I’m not sure which one nor how to find out.
I upgraded to the latest version of Psychopy (2021.2.3) earlier today - before I did that, I was on 2021.1.4 and all the ‘resources’ used to load fine and I could get through the experiment without problems. I thought by upgrading to the new version I could get the ‘pause’ code to work (I read it now required js to be changed to ‘both’ and to snapshot in the java section) but I actually had to delete that section from my experiment after the upgrade as I couldn’t get it to work at all if it was in there, which was disappointing. Rather than try to revert to an older version to get my experiment to run again, I would be really grateful if someone could help me resolve the new problem with my images.

btw, in the i get the psychopy runner window i get the following alerts twice, not sure if they’re causing the issue as the images are displayed in compressed form in a smaller window on the screen (I set w,h of screen to 0.5 0.5), plus i got them before as well when everything worked - Alert 2115:Your stimulus size exceeds the X dimension of your window. For further info see 2115: Stimulus size is bigger than the window dimensions — PsychoPy v2021.2

Ok, so I’ve solved the problem - or rather the problem solved itself.
After a restart, I deleted the Pavlovia experiment, moved it to another folder, and re-uploaded it, and now it works. I presume something may have lingered on from my previously installed version of psychopy that was creating problems. not sure why it also required deletion and re-instatement on Pavlovia, but what’s important is that all resources are loading!
thanks to those who read my message. hopefully it helps someone experiencing similar problems in the future.
kind regards

now i have another problem - while piloting works, it displays an old version of the experiment, which includes components i’ve deleted (e.g. the pause routine that i couldn’t get to work). meanwhile, the piloting of js works fine from the runner. are there any files i need to delete manually?
also, it only works with this old version in pilot mode - if i go to ‘running’ it doesn’t work (i.e. freezes on ‘initialising expt’). i seem to remember from reading the help forums that the pop up window for expt information does not work in the new version, but how do i get the participant number in otherwise? help would be much appreciated, i’ve spent way too much time myself trying to figure things out and feel like i’ve hit a bit of a wall.
kind regards

after fixing the errors above by deleting the hidden git folder and files, i had the majority of the experiment working. i fiddled with a few small things - changing a few images (keeping the same file names) and things like screen durations, but now i get an error that it says i should send to developers - it says ‘expInfo’ is missing and shuts down my psychopy every time i try to upload the project on pavlovia. i cannot find developer contact details on the site or in the program. could anyone help me please?

here’s the whole error, now i simply cannot set up my project on pavlovia any more as when i try to create it, i get this:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 829, in findPathsInFile
filePath = eval(filePath)
File “”, line 1, in
NameError: name ‘expInfo’ is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\”, line 1363, in onPavloviaRun
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\”, line 793, in fileExport
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\scripts\”, line 74, in generateScript
compileScript(infile=exp, version=None, outfile=filename)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\scripts\”, line 247, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\scripts\”, line 219, in _makeTarget
script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 254, in writeScript
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\experiment\”, line 309, in writeFlowSchedulerJS
resourceFiles = set([resource[‘rel’].replace("\", “/”) for resource in self.exp.getResourceFiles()])
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 877, in getResourceFiles
condsPaths = findPathsInFile(params[‘conditionsFile’].val)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 843, in findPathsInFile
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 860, in findPathsInFile
conds = data.importConditions(thisFile[‘abs’]) # load the abs path
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\”, line 479, in importConditions
(fileName, len(trialList), len(fieldNames)))
UnboundLocalError: local variable ‘trialList’ referenced before assignment

Did you delete all of your expInfo dialogue boxes?

If you accidentally corrupt your experiment by removing all variables from the expInfo section, try adding <Param name="Experiment info" updates="None" val="{'participant': ''}" valType="code"/> to the Settings section of your Builder .psyexp file in a text editor.

Thanks a lot for your reply!

When I click on the experiment info section, I can see the following:

and accordingly in the .psyexp file there is the following section:

<Param name="Experiment info" updates="None" val="{'participant': '', 'age': '', 'gender': '', 'do you play a musical instrument?': '', 'if yes, which one?': ''}" valType="code"/>

i tried moving it to the top of the settings, in case it mattered, but that didn’t help either. i still get the same error and the study doesn’t want to upload to Pavlovia because of it.

kind regards

Dear wakecarter,

your solution from here fixed my problem!

I am glad I dug it up on the forum. I really like psychopy but am a bit perplexed why some issues only manfiest now, when earlier they seemed to work fine. i do feel like i’m getting somewhere now, after being stuck for 2 days in a circle!

1 Like