Missing Routine when Uploading to JavaScript

Currently, I am trying to add more routine into my experiment. I have successfully uploaded my local Python code to online JavaScript many times before but this time, after many tries, the online version stayed the same as my last upload last week.

OS : MacOS 10.13.6
PsychoPy version : v2021.1.2
Standard Standalone? (y/n) y
What are you trying to achieve?:
I have my main experiment completed (and uploaded to online as well) and I am now adding some routines for a brief Line Bisection Task using sliders in between the two blocks. Each routine includes some text, a slider, and a code component that defines the start of the marker position and allows the participant to move the marker from right to left using keys.

What did you try to make it work?:
It works locally and it showed up on my Python code when I inspect the coding view; however, when it is synced the routine doesn’t show up on Pavlovia and to look more into it I specifically convert it to the JS view, none of the newly added routines are in there. I also tried to convert it to JS and upload it to Pavlovia but the line bisection component didn’t show up. I also made sure that I clear any keyboard events at the end of a routine preceding these newly added ones but it didn’t make much of a change.

I have searched through the forums and double-checked that I am using the latest version of PsychoPy (and also set it in the experiment setting as well). I checked the PsychoPy Crib Sheet for anything specific to sliders and read through the links referenced on there too. There are some discussion on that forms works locally but disappears on Pavlovia. I wasn’t sure if that is the case happening with the slider?

What specifically went wrong when you tried that?:
The newly added routine still didn’t show up after multiple tries of just uploading single trials to troubleshoot. The experiment just continues to run without showing the added routine and it just seems similar to the code from several commits ago.

Any help would be appreciated,
and thank you very much!

Are you clearing your cache (Ctrl-Shift-R)?

Hello, thank you for your reply! Yes, I am clearing the cache and checking to make sure that I am running on the latest code. But when I go into View Code and see the files uploaded, sometimes the JS script is not updated to my latest commit. And even when I convert the JS script separately offline to search for the new routine in the code, I can’t seem to find it? This is the first time I’ve encountered this problem trying to upload a new part of the experiment online.

I was wondering if it had anything to do with my file path? When I am uploading it gives me these INFO lines. The experiment being updated is called MA_Pilot.psyexp. which is located inside a folder called First_Pilot
3925.2690 INFO /Applications/PsychoPy.app/Contents/MacOS/python -m psychopy.scripts.psyexpCompile /Users/GraceW./First_Pilot/MA_Pilot.psyexp -o /Users/GraceW./First_Pilot/MA_Pilot.py -v 2021.1
4087.4218 INFO Investigating repo at /Users/GraceW./First_Pilot

Any pointers would be greatly appreciated. Thank you.

Are you getting any errors when you sync? If the JS file on Gitlab isn’t updating then that probably means there was an error when PsychoPy tried to create the new file.

Thank you again for the prompt response. I had encountered an error when I am syncing with my old PsychoPy version (which was just left blank in the experiment setting). The error details were:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 822, in findPathsInFile
File “”, line 1, in
NameError: name ‘group’ is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/openpyxl/reader/excel.py”, line 121, in _validate_archive
File “zipfile.pyc”, line 1131, in init
File “zipfile.pyc”, line 1198, in _RealGetContents
zipfile.BadZipFile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 1320, in onPavloviaSync
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 759, in fileExport
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 73, in generateScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 242, in compileScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 214, in _makeTarget
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 229, in writeScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/flow.py”, line 289, in writeFlowSchedulerJS
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 870, in getResourceFiles
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 836, in findPathsInFile
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 853, in findPathsInFile
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/data/utils.py”, line 365, in importConditions
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/openpyxl/reader/excel.py”, line 174, in load_workbook
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/openpyxl/reader/excel.py”, line 124, in _validate_archive
File “zipfile.pyc”, line 1131, in init
File “zipfile.pyc”, line 1198, in _RealGetContents
zipfile.BadZipFile: File is not a zip file

The ‘group’ referred to is a string variable in the code component at the beginning of the experiment to counterbalance participants. I went on the forum discussion and found a solution where I was able to upload without error by changing the PsychoPy version to specify the 2021.1. But perhaps simply changing the version didn’t completely solve the problem? Maybe changing the version to be different from what I used before interrupted how JS file is generated on Gitlab?

Thank you for your time!

You are using one of my versions to avoid so it might be worth upgrading.

Thank you for this!

I have upgraded my PsychoPy to 2021.1.4 and restarted my experiment on it. In the experiment setting, I also set the use PsychoPy version to 2021.1.4 as well. However, when I tried to sync it gave me a similar internal error:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 829, in findPathsInFile
File “”, line 1, in
NameError: name ‘group’ is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/openpyxl/reader/excel.py”, line 121, in _validate_archive
File “zipfile.pyc”, line 1131, in init
File “zipfile.pyc”, line 1198, in _RealGetContents
zipfile.BadZipFile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 1320, in onPavloviaSync
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 759, in fileExport
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 73, in generateScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 242, in compileScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 214, in _makeTarget
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 229, in writeScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/flow.py”, line 289, in writeFlowSchedulerJS
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 877, in getResourceFiles
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 843, in findPathsInFile
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 860, in findPathsInFile
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/data/utils.py”, line 365, in importConditions
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/openpyxl/reader/excel.py”, line 174, in load_workbook
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/openpyxl/reader/excel.py”, line 124, in _validate_archive
File “zipfile.pyc”, line 1131, in init
File “zipfile.pyc”, line 1198, in _RealGetContents
zipfile.BadZipFile: File is not a zip file

So, just seeing what works and what doesn’t, when I changed the PsychoPy version to 2020.2.10 in the experiment setting, it will upload without error but the JS remains the same.

Thank you for all your help!

Just a brief happy update :smile: I found a solution from looking at the other two similar discussions:

What I ended up doing was to try and upload a simple test sequence onto Pavlovia and realize my path is not set correctly. So I went back to my folder to look for the hidden .git folders to delete them (on MacOS, I went to the folder and held down the Command, Shift and Period keys: cmd + shift + [.] the hidden folder will appear transparent until you held down the same keys again).

And I just make sure I am using and set to the latest PsychoPy version (not on the avoid list) and re-uploaded my local experiment as a new project on Pavlovia and now it works!
Thank you again for your response and time.

1 Like

I’m getting the same ‘zipfile.BadZipFile: File is not a zip file’ error when trying to sync my experiment and also when trying to compile a JS script. It seems a JS file is not being created and I’m getting this error instead. I’m using version 2021.1.4.

I have tried deleting the project on Pavlovia and the .git folder and creating a new experiment. I have also ensured the .psyexp file name and experiment name match, but I’m still not having any luck with syncing/compiling a JS script.

Does anyone have ideas for other things I might try? The full error is here:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment_experiment.py”, 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\PsychoPy3\lib\site-packages\openpyxl\reader\excel.py”, line 121, in _validate_archive
archive = ZipFile(filename, ‘r’, ZIP_DEFLATED)
File “C:\Program Files\PsychoPy3\lib\zipfile.py”, line 1108, in init
self._RealGetContents()
File “C:\Program Files\PsychoPy3\lib\zipfile.py”, line 1175, in _RealGetContents
raise BadZipFile(“File is not a zip file”)
zipfile.BadZipFile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 1320, in onPavloviaSync
self.fileExport(htmlPath=htmlPath)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 759, in fileExport
target=“PsychoJS”)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 73, in generateScript
compileScript(infile=exp, version=None, outfile=filename)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 242, in compileScript
_makeTarget(thisExp, outfile, targetOutput)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\psyexpCompile.py”, line 214, in _makeTarget
script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment_experiment.py”, line 229, in writeScript
self_copy.flow.writeFlowSchedulerJS(script)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\flow.py”, line 289, in writeFlowSchedulerJS
resourceFiles = set([resource[‘rel’].replace("\", “/”) for resource in self.exp.getResourceFiles()])
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment_experiment.py”, line 877, in getResourceFiles
condsPaths = findPathsInFile(params[‘conditionsFile’].val)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment_experiment.py”, line 843, in findPathsInFile
files.extend(findPathsInFile(str(condFile)))
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment_experiment.py”, line 860, in findPathsInFile
conds = data.importConditions(thisFile[‘abs’]) # load the abs path
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\data\utils.py”, line 365, in importConditions
wb = load_workbook(filename=fileName, data_only=True)
File “C:\Program Files\PsychoPy3\lib\site-packages\openpyxl\reader\excel.py”, line 174, in load_workbook
archive = _validate_archive(filename)
File “C:\Program Files\PsychoPy3\lib\site-packages\openpyxl\reader\excel.py”, line 124, in _validate_archive
archive = ZipFile(f, ‘r’, ZIP_DEFLATED)
File “C:\Program Files\PsychoPy3\lib\zipfile.py”, line 1108, in init
self._RealGetContents()
File “C:\Program Files\PsychoPy3\lib\zipfile.py”, line 1175, in _RealGetContents
raise BadZipFile(“File is not a zip file”)
zipfile.BadZipFile: File is not a zip file

SOLVED - I resolved this by copying my experiment psyexp file, spreadsheets and stimuli into a completely new project folder and then synced this to Pavlovia successfully.