[issue2301] [Py3k] No text shown when SyntaxError (when not UTF8)

Martin v. Löwis report at bugs.python.org
Mon Mar 17 12:18:17 CET 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

You are probably right about the source of the problem; I was confusing 
it with a regular exception, e.g.

print("年",a)

However, I also fail to reproduce the problem on OSX. I get

  File "a.py", line 3
    print "�N"
             ^
SyntaxError: invalid syntax

I'm not quite sure what the N is doing in there, but the first character 
is the replacement character (hopefully, the tracker will reproduce it 
correctly); I get that because pythonrun uses the "replace" codec.

I guess you are not seeing it because then the replacement character 
cannot actually be output to your terminal. Please try

print("\ufffd")

to see what that does.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2301>
__________________________________


More information about the Python-bugs-list mailing list