PyDev raises SyntaxError on package with .pyd files
Hi,
I am trying to debug a script that depends on a package which has been compiled. It has a __init__.pyd files which when loaded into the debugger I get:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.3.2\helpers\pydev\pydevd.py", line 1596, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.3.2\helpers\pydev\pydevd.py", line 974, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\Python27-13\lib\site-packages\package_name\module\__init__.pyd", line 1
SyntaxError: Non-ASCII character '\x90' in file C:\Program Files\Python27-13\lib\site-packages\package_name\module\__init__.pyd on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
I am using python 2.7 with PyCharm 2016.3.2. Any tips?
Thanks,
Nathan
请先登录再写评论。
Hello! Do you have this error only in Debug mode or in Run mode too?
Only in debug mode. The scripts in my project are typically run as modules "python -m" and when I remove the .pyd files and let the scripts run without being compiled I get errors about relative imports.
from . mymodule import class_name
is how the imports are formatted. The scripts are for a company that typically uses Linux development environments so I expect that I need to play with the run configurations to get things working right. Any advice on that?
Thanks for the help!
Hi! Please, provide a screenshot with your Run configuration in PyCharm, when your script works fine without debugger (with "-m" option as I understood from your description).