Reputation: 396
I am fighting a few hours trying to configure PyCharm for debugging my app. I was looking for solution, but twisted seems to not be so popular and there is weak support. Below I put error log that i got.
/usr/local/bin/python3.4m -u /Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_run_in_console.py 57276 57277 /usr/bin/twistd -y /Users/artur/projs/private/elanga-web/start_app.tac
Running /usr/bin/twistd
PyDev console: starting.
Traceback (most recent call last):
File "/usr/bin/twistd", line 7, in <module>
import _preamble
ImportError: No module named '_preamble'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_run_in_console.py", line 68, in <module>
globals = run_file(file, None, None)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_run_in_console.py", line 28, in run_file
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/usr/bin/twistd", line 9, in <module>
sys.exc_clear()
AttributeError: 'module' object has no attribute 'exc_clear'
Process finished with exit code 1
Couldn't connect to console process.
I will be grateful for an answer why there is no such module like _preamble
Upvotes: 3
Views: 1667
Reputation: 31860
On OS X, /usr/bin/twistd
is a version of Twisted installed into the system python. This is not python 3.4. The symptom you're seeing is not the missing _preamble
module (which is in fact not supposed to be installed, which is why there is an except
block around that import catching the exception) but rather that you have pointed python 3.4 at some random python 2 program.
If you want to run python 3.4, you need to create a python 3 environment with Twisted installed. Keep in mind that not all of Twisted is ported, so only a subset of APIs will be available to you. One of the things that is not ported to python 3 yet is the twistd
command line, so there's no way to run twistd
with python 3 yet.
Upvotes: 6