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

URL of experiment: Pavlovia

GitLab: Sign in · GitLab

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/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py“, line 1221, in onPavloviaSync
File „/Applications/psychopy_2020_2.9/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py“, line 719, in fileExport
File „/Applications/psychopy_2020_2.9/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py“, line 73, in generateScript
File „/Applications/psychopy_2020_2.9/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py“, line 242, in compileScript
File „/Applications/psychopy_2020_2.9/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py“, line 214, in _makeTarget
File „/Applications/psychopy_2020_2.9/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py“, line 259, in writeScript
File „/Applications/psychopy_2020_2.9/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/routine.py“, line 285, in writeRoutineBeginCodeJS
File „/Applications/psychopy_2020_2.9/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/sound/init.py“, 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 init.py 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

Hello,

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.

Hello,

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?

https://discourse.psychopy.org/t/js-reserved-keywords-causing-crash/20770/2

https://discourse.psychopy.org/t/js-compile-typeerror-str-returned-non-string-type-nonetype/20785

Have not found any solution yet.

Temporary solution here: Errors Pushing to Pavlovia PsychoPy 2021.1.0

I think this is all fixed in 2021.1.2, which you can now download

1 Like

Hey jon – not sure if this is just me, but while the error is no longer triggered I am also not getting the .js files to update, no matter how I push for the conversion (e.g., Export to HTML, on save, on sync, etc.). It either opens up the .js file made previously or (if the file is missing) comes up with a blank coder window.

@darkoodic are there any warnings appearing in the bottom of the Runner view?

hey everyone! Thanks for your help! I got the experiment running online with @jon jon’s tip about changing the valueType in the feedback component. Errors Pushing to Pavlovia PsychoPy 2021.1.0 - #4 by jgeller112

My colleague and I also have been able to work around some other issue by not including paths in sound or picture components that are played by loop such as ‘resources/’ +$audio; instead I only use $audio and include the path in the conditions file. There seems to be an issue with the translation of the path into JS.

@jon: I wonder whether it could be an issue underlying of working with a Mac OS or maybe keyboard language settings? I’ve been running into this issue multiple times now.

All the current issues relate to 2020.2.9 → we’ve briefly tried to use a newer version but ran into the same issues as @darkoodic So we are staying at the older version for now, since or student assistants also work with this version.

I’ve now got one remaining issue and that is including pictures in a feedback message of a code component. I’ve managed before to include text feedback messages … since we are offering experiments to young children, however, pictures would be better. For some reason, I’m receiving an error message when conducting the experiment online. Specifying the file path outside of the feedback message is not an issue. This seems to be a problem specific to the feedback component and I would really like to find a solution. I’m posting below the code component, the error message and the part in the psychopy-code where the feedback message is specified.

Do you have an idea on how to solve this or can point me into the direction of other helpful posts? feedback_message.csv (1.8 KB)

@amaschmi Your post is no longer about the title of this thread. In general you should then open a different thread to discuss your topic. But from your post I think it’s most likely just that PsychoPy doesn’t know to send the file resources/puzzled_small.png to participant computers so it doesn’t show up for them. When resources (images, sounds etc) are declared in conditions files then PsychoPy can auto-detect them and add the to a list of required resources but when they are defined by a code component (or by combining a string with a variable) you need to explicitly tell the experiment these are needed:

  • In Experiment Settings go to the Online tab
  • you’ll find an option for adding extra resource files there

I think that’s the issue with using "folder/" + filenameVariable too

Thanks Jon! Now everything worlks like a charm! I also shared the issue in a new topic and linked to your solution!

Hey @jon – sorry for my delay in replying. I did diagnose and fix the problem: I had 2021.1.1 version specified in the Settings, which was no longer the correct one. Changing that generated the .js file just fine, so it’s was my fault entirely and an easy solution!

1 Like