PyDev coding error when debugging after update
We recently updated Eclipse 4.4 / PyDev 3.8 from Eclipse 4.2 / PyDev 2.7. Unfortunately, we now get this error when we run our code as Debug:
Traceback (last call last): File "C: \ Programs \ eclipse \ Plugins \ org.python.pydev_3.8.0.201409251235 \ pysrc \ pydevd.py", line 2183, in globals = debugger.run (setup ['file' ], None, None) File "C: \ Programs \ eclipse \ plugins \ org.python.pydev_3.8.0.201409251235 \ pysrc \ pydevd.py", line 1622, in perspective pydev_imports.execfile (file, globals, locals) # execute script "C: \ Mercurial \ ABC \ tools \ foo.pyc", line 1 SyntaxError: non-ASCII character '\ xf3' in C: \ Mercurial \ ABC \ tools \ foo.pyc on line 1, but no coding announced; see http://www.python.org/peps/pep-0263.html for details
The same code works fine when run like a regular Python Run, and it works fine in both Run and Debug in the old Eclipse / PyDev version.
From what I've found on Stack Overflow and the internet, the standard solution when you get this error is to add "# coding = utf-8" to the beginning of the file. However, we have no control over "foo.pyc" - there is no way to modify this file. Is there anything else we can try?
The python version is 2.7.
source to share
From the error it seems like a Python problem where you have to declare the file encoding at the top (as stated by http://www.python.org/peps/pep-0263.html )
ie: Usually just
#coding: utf-8
at the top of the file does the trick (using the actual encoding you are using).
If it is not and you have declared the encoding, enter a question into the PyDev tracker: https://sw-brainwy.rhcloud.com/tracker/PyDev/
source to share