Debugging twisted application using PyCharm

Artur Gurgul

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

Glyph

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

debugging a uwsgi python application using pycharm

From Dev

How debuging twisted application in PyCharm

From Dev

Debugging PyCharm?

From Dev

using twistd to run a twisted application but script run twice

From Dev

Azure Application Insights Debugging using the Call Stack

From Dev

using the pycharm debugger with a flask application factory

From Dev

PyCharm and debugging private attributes

From Dev

Debugging Flask in PyCharm

From Dev

Debugging with PyCharm terminal arguments

From Java

interactive shell debugging with pycharm

From Dev

Debugging inside PyCharm IPython

From Dev

PyCharm: debugging line by line?

From Dev

Debugging Popen subprocesses with PyCharm

From Dev

how to debug twisted trial unittest in pycharm

From Dev

Using rabbitmq with twisted

From Dev

Twisted getpage using proxy

From Dev

importError with pyinstaller using Twisted

From Dev

Twisted getpage using proxy

From Dev

Debugging Heap Space Problems in Groovy/Grails Application using Quartz

From Dev

Debugging Heap Space Problems in Groovy/Grails Application using Quartz

From Dev

pyCharm Debugging: skip framework code

From Dev

Remote Python debugging with PyCharm and Vagrant

From Dev

Pycharm Django Debugging is really slow

From Dev

PyCharm debugging - set next statement

From Dev

Remote Python debugging with PyCharm and Vagrant

From Dev

How to call an ncurses based application using subprocess module in PyCharm IDE?

From Dev

Using Tornado and Twisted at the same time

From Dev

Error when using twisted and greenlets

From Dev

Using twisted on OS X Mavericks