psychopy/psychopy — Issue #97: print(u"Österreich") raises error in coder
Author: derNarr
Created: 2012-01-26 22:43:16+00:00
State: open

if you run the following commands from the coder gives raises the following error:

print(u"Österreich")

SyntaxError: Non-ASCII character '\xc3' in file umlaute3.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

If you add a correct encoding line the error changed to: (\xd6 is the unicode sequence for Ö)

# -*- encoding: utf-8 -*-
print(u'Hallo \xd6sterreich')

File "umlaute2.py", line 2, in
print(u'Hallo \xd6sterreich')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 6: ordinal not in range(128)

Running the same commands in the python or ipython shell (even inside from psychopy) does not raise the error. (Same for executing the file with python file.py from the commandline.)

Is there a fix, to use unicode and the print command out of psychopy?