SyntaxError: Non-ASCII character
Rustom Mody
rustompmody at gmail.com
Sun Jul 17 05:57:31 EDT 2016
On Sunday, July 17, 2016 at 2:56:53 PM UTC+5:30, Chris Angelico wrote:
> On Sun, Jul 17, 2016 at 7:19 PM, wrote:
> > wf = wave.open(“test.wav”, “rb”)
>
> Watch your quotes. They want to be flat quotes, U+0022 "this sort",
> not any sort of typographical quote.
>
> Recommendation: Use a programmer's editor, not a word processor, for
> working with code. As well as not mangling it, it'll often show you
> problems before they happen.
>
> Also, recommendation: Use Python 3, not Python 2. Your code looks like
> it's intended for Py3, but your error says that you ran it under Py2.
> The solution may be as simple as running "python3 script.py" rather
> than "python script.py".
Happens when you cut paste… from web but especially from pdfs
I dare say that Python3’s :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ariston/foo.py", line 31
wf = wave.open(“test.wav”, “rb”)
^
SyntaxError: invalid character in identifier
is probably worse than Python2’s
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "foo.py", line 31
SyntaxError: Non-ASCII character '\xe2' in file foo.py on line 31, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
More information about the Python-list
mailing list