| Reference | Downloads | Github

Exporting to html - problem with encoding

I’ve found unexpected error while exporting procedure from PsychoPy v1.85.1 to html. It seems that there is a problem with encoding. However I don’t know how to deal with it.

Any ideas?

Welcome to PsychoPy2!
Traceback (most recent call last):
File “/Applications/”, line 1624, in fileExport
File “/Applications/”, line 2141, in generateScript
File “/Applications/”, line 231, in writeScript
File “/Applications/”, line 1933, in writeInitCodeJS
File “/Applications/”, line 130, in writeInitCodeJS
inits = getInitVals(self.params, ‘PsychoJS’)
File “/Applications/”, line 231, in getInitVals
valStr = str(inits[name].val).strip()
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u0119’ in position 12: ordinal not in range(128)

We’ve managed to circumvent the problem by throwing out text content of TextStim objects (which contained non-ascii characters). Is this something that was solved recently (I have a vague recollection that it was mentioned on github some time ago)?

Ah, looks like there’s still a reference to str() that shouldn’t be there. Maciek, could you try editing the file
/Applications/ and replacing all instances of:




Ok, I’ve found 2 instances of


and replaced it with


as you suggested. After that PsychoPy do not inform about any error during exporting to html and index.html file is being successfully been created. It seems that everything is just fine. Thank You!