Hello,
I’m very new to both PsychoPy and this forum, so appologies if I’m asking a silly question!
I’m trying to run an existing script and to translate the experiment into my language (Czech). However, if I put non-ascii characters into the line that prints experiment instructions, I get the following error message:
File “D:\Documents\Studijni_texty\Bakalarka\Experiment\rcictask.py”, line 11
SyntaxError: Non-ASCII character ‘\xc3’ in file D:\Documents\Studijni_texty\Bakalarka\Experiment\rcictask.py on line 11, but no encoding declared; see PEP 263 – Defining Python Source Code Encodings | peps.python.org for details
I tried, therefore, to specify the encoding at the very beginning of the script as follows:
However, when running the script, I got the following message:
Traceback (most recent call last):
File “D:\Documents\Studijni_texty\Bakalarka\Experiment\rcictask.py”, line 14, in
infoDlg = gui.DlgFromDict(dictionary=info, title=‘rcicr demo’, order=[‘Instruction’, ‘Stimuli folder’, ‘Data file’])
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\gui\qtgui.py”, line 377, in init
self.addField(field, self.dictionary[field], tip=tooltip)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\gui\qtgui.py”, line 174, in addField
inputBox = QtWidgets.QLineEdit(unicode(initial), parent=self)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 4: ordinal not in range(128)
As I understand it (correct me please, if I’m wrong), the script requires ascii encoding for line 14. Is there a way to change the encoding for specific commands? Or do you have any different recommendation?
Thanks!
Anna