Reputation: 925
I have a python code which runs perfectly and I compiled it using py_compile.compile. The compile operation also worked nicely without any errors.
However, when I use this pyc file I get an error like
File "E:/tech/tech.pyc", line 1
SyntaxError: Non-ASCII character '\xf3' in file E:/tech/tech.pyc on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
My question is how do I debug this error? The first line in my script is import os. I tried using
#!/usr/bin/python
It does not help either. Any suggestions on how this can be debugged?
Upvotes: 3
Views: 990
Reputation: 46443
You're doing something wrong. Please show your code. '\xf3'
looks a lot like the pyc magic number to me (assuming you're using python 2.7):
>>> import imp
>>> imp.get_magic()
'\x03\xf3\r\n'
Are you trying to compile a pyc file (as if it were python source code)?
Upvotes: 2