# Missing Routine when Uploading to JavaScript

**URL:** <https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064>\
**Category:** Online experiments\
**Tags:** pavlovia\
**Created:** [May 18, 2021, 8:41am UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064 "2021-05-18T08:41:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwang24](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gwang24/32/14752_2.png) [@gwang24](https://discourse.psychopy.org/u/gwang24)\
**Post date:** [May 18, 2021, 8:41am UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/1 "2021-05-18T08:41:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 18, 2021, 8:51am UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/2 "2021-05-18T08:51:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gwang24](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gwang24/32/14752_2.png) [@gwang24](https://discourse.psychopy.org/u/gwang24)\
**Post date:** [May 18, 2021, 4:01pm UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/3 "2021-05-18T16:01:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 18, 2021, 4:31pm UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/4 "2021-05-18T16:31:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gwang24](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gwang24/32/14752_2.png) [@gwang24](https://discourse.psychopy.org/u/gwang24)\
**Post date:** [May 18, 2021, 4:42pm UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/5 "2021-05-18T16:42:01Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 18, 2021, 4:45pm UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/6 "2021-05-18T16:45:57Z")

</div>

You are using one of my [versions to avoid](https://discourse.psychopy.org/t/psychopy-versions-to-avoid/22924) so it might be worth upgrading.

---

<div class="post-metadata">

**Author:** ![gwang24](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gwang24/32/14752_2.png) [@gwang24](https://discourse.psychopy.org/u/gwang24)\
**Post date:** [May 18, 2021, 5:03pm UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/7 "2021-05-18T17:03:44Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![gwang24](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gwang24/32/14752_2.png) [@gwang24](https://discourse.psychopy.org/u/gwang24)\
**Post date:** [May 18, 2021, 9:33pm UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/8 "2021-05-18T21:33:56Z")

</div>

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

- [Can’t sync my experiment from Pavlovia to the Builder](https://discourse.psychopy.org/t/cant-sync-my-experiment-from-pavlovia-to-the-builder/22975)
- [Project unable to sync. Won’t permit local path](https://discourse.psychopy.org/t/project-unable-to-sync-wont-permit-local-path/13678)

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.

---

<div class="post-metadata">

**Author:** ![milsandhills](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@milsandhills](https://discourse.psychopy.org/u/milsandhills)\
**Post date:** [September 15, 2021, 10:39am UTC](https://discourse.psychopy.org/t/missing-routine-when-uploading-to-javascript/23064/9 "2021-09-15T10:39:04Z")

</div>

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.
