| Reference | Downloads | Github

Error syncing "TypeError: __str__ returned non-string (type NoneType)"

URL of experiment:

Description of the problem:

Syncing fine to Pavlovia all morning, all of a sudden getting this error:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\", line 1221, in onPavloviaSync
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\", line 719, in fileExport
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\", line 73, in generateScript
    compileScript(infile=exp, version=None, outfile=filename)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\", line 242, in compileScript
    _makeTarget(thisExp, outfile, targetOutput)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\scripts\", line 214, in _makeTarget
    script = thisExp.writeScript(outfile, target=targetOutput, modular=True)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\", line 260, in writeScript
    self_copy._currentRoutine.writeEachFrameCodeJS(script, modular)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\", line 343, in writeEachFrameCodeJS
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\movie\", line 267, in writeFrameCodeJS
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\experiment\components\", line 381, in writeStopTestCodeJS
    buff.writeIndentedLines(code % self.params)
TypeError: __str__ returned non-string (type NoneType)

All I did between this and the last sync was replace some .png files and change size parameters of image components. How on earth to troubleshoot this??

I also updated the conditions file in the loop (which is what is controlling presentation of the aforementioned images)

I have tried changing all the looping size/position parts of the image component and the text component in the routine that I was editing when this issue began. I also tried removing the .pngs that I edited since the last sync. Error persists.

Solved: a stray $

Thanks for documenting! I am having a similar error-- did you find the stray $ just by luck or did you find something in the output that pointed you to where it was?

Unfortunately if I recall correctly I think I found it by chance. I suspect that I put a $ in one of the non-string fields of an image component.

Found mine, I had accidentally deleted a comma between the width and height on one of my components.

P.S. I was able to narrow down which component it was because each time I clicked on that component in builder, a message popped up in the runner reading:

8616.5473     ERROR     invalid syntax (<unknown>, line 1)

and if I tried edit anything in the component, it would read:

8592.9439     ERROR     unexpected EOF while parsing (<unknown>, line 1)

FYI I just had a similar problem in 2021.2.3 and the issue was that I had accidentally labeled the start time as 01 instead of 1.