Unhandled internal error pushing new project to Pavlovia

OS (e.g. Win10): macOS Catalina 10.15.6
PsychoPy version (e.g. 1.84.x): 2020.2.4

What are you trying to achieve?:
Trying to push new experiment to Pavlovia (not associated with project yet) but get following error. (Can’t link to git because I haven’t been able to create project yet).

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 1221, in onPavloviaSync
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 719, 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 251, in writeScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/routine.py”, line 277, in writeRoutineBeginCodeJS
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py”, line 202, in writeRoutineStartCodeJS
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py”, line 405, in writeParamUpdatesJS
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py”, line 399, in writeParamUpdates
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/_base.py”, line 435, in writeParamUpdate
TypeError: str returned non-string (type NoneType)

What did you try to make it work?:
Experiment runs fine locally.
I’m wondering if it’s because the new TextBox feature only works in Psychopy locally, and not on Pavlovia? (There seems to be a similar issue in this post "Unhandled Internal Error" Trying to Launch Experiment Online).

Hi There,

Whilst at the moment I can’t speak directly to what is causing this sync issue, I can say I don’t think it is because of the textbox feature - that works online with a tweak https://gitlab.pavlovia.org/Hirst/textboxdemo

Are you able to push and sync other projects?
Becca

I isolated the issue to an issue with calling files. I need to concatenate strings and variables to select the correct file.

I wrote a code component to concatenate in PsychoPy, and another to concatenate in psychoJS and the issue is resolved!

Hi lorentlm,

I’m so happy for you that you managed to resolve the issue!

My experiment runs perfectly fine locally - I am using macOS Catalina too, and ver 2020.2.3. But when I try to sync my project to Pavolvia, I face the same issue, with the same traceback. Could you share your written Code Component that resolved the issue and where to place the code please?

Thank you, I greatly appreciate your help!

Hi @psystudies,

You will need to put a code component something like the one below at the beginning of the routine where you set your stimulus component after you have actually chosen the variables you want for your stimulus. Your psychoJS code component will differ depending on the filepath you used for your loaded stimuli but here is a sample:

image_name = Sex.concat("/Face/", Face_Image.toString());

-Here I’ve created a variable image_name that holds the appropriate filepath for the stimulus I want on this trial, which I then put into the Image box of the Image component on the desired routine
-Sex (which is a variable set to the appropriate stimulus sex for this trial and denotes the folder I want), is concatenated with the text “/Face/” (the next subfolder I want), and the file I want (which is held in the variable name Face_Image and was set at the beginning of the routine, like Sex); so if Sex = Female and Face_Image = 001.png the string will read Female/Face/001.png.

I hope this helps!