| Reference | Downloads | Github

TypeError: __str__ returned non-string (type NoneType), Error interferes with building html-export js-File

URL of experiment: Pavlovia


Description of the problem: Error messages relating to sound component when creating html/export in version 2020.2.9

Hey everyone!

I’m currently trying to get a relatively simple letter knowledge experiment running but I have some issues in creating the html export in the psychopy3-version in which the experiment was built.

In the experiment I use .wav-Files that are randomly presented during practice and test trials. I have been trying to create an HTML-export in version 2020.2.9 but I only get an index.html-File no .js-Files, due to this error message:

Traceback (most recent call last):
File „/Applications/psychopy_2020_2.9/“, line 1221, in onPavloviaSync
File „/Applications/psychopy_2020_2.9/“, line 719, in fileExport
File „/Applications/psychopy_2020_2.9/“, line 73, in generateScript
File „/Applications/psychopy_2020_2.9/“, line 242, in compileScript
File „/Applications/psychopy_2020_2.9/“, line 214, in _makeTarget
File „/Applications/psychopy_2020_2.9/“, line 259, in writeScript
File „/Applications/psychopy_2020_2.9/“, line 285, in writeRoutineBeginCodeJS
File „/Applications/psychopy_2020_2.9/“, line 138, in writeRoutineStartCodeJS
TypeError: str returned non-string (type NoneType)
Bildschirmfoto 2021-02-22 um 20.08.20
My issues do not relate to the sound-file-format since the instruction sound-files work fine. The code line in file in relates to a stopVal definition within the sound component. But I don’t understand why this would be relevant, since I don’t need a stopVal for sound in this experiment.

I’ve tried exporting an html file in an older version of the experiment 2020.1.3 → which works fine. But then I get issues with sound files hat should be fetched from the condition-files. So the error might have something to do with that, however - I cannot find a syntax error in my builder components. I’ve attached a pic of the sound component and correspondign loop below.

Do you find an error in my syntax?
Do you know what exactly the error message is referring to?

Can you? Bildschirmfoto 2021-02-22 um 20.08.32


try a different name than sound for your sound-files. PsychoPY does not like duplicate names.

Best wishes Jens

Thanks for the suggestion - I’ve already tried that. No improvements.

Could it have something to do with user preferences from a prior Psychopy-Version I installed? I uploaded a couple of experiments last year with psychopy 2020.1.3 that are still running. Now I’m trying to get experiments running that are build on 2020.2.9. I can export a JS file when I set the experiment version to 2020.1.3 in the experiment settings but not when I set it to the current version of 2020.2.9. I also tried older 2020.2 versions (i.e., 2020.2.5) but it doesn’t work. It must be an translating issue from python to js, but I cannot figure out the underlying issue.


as a matter of fact I never set the PsychoPy-version explicitly. PsychoPy does not work properly with duplicate names in any version, perhaps the checking just differs. Look here to clear the preferences.

Best wishes Jens

Hi all, this looks like the same problem I and others are experiencing and my be due to handling of if statements?

Have not found any solution yet.