【问题标题】:Debugging twisted application using PyCharm使用 PyCharm 调试扭曲的应用程序
【发布时间】:2015-12-22 23:58:09
【问题描述】:

我正在努力配置 PyCharm 以调试我的应用程序。我一直在寻找解决方案,但twisted 似乎并不那么受欢迎,并且支持薄弱。下面我放了我得到的错误日志。

/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.

如果没有像 _preamble 这样的模块,我将不胜感激

【问题讨论】:

    标签: python debugging twisted pycharm


    【解决方案1】:

    在 OS X 上,/usr/bin/twistd 是安装到系统 python 中的 Twisted 版本。这不是 python 3.4。您看到的症状不是缺少 _preamble 模块(实际上 not 应该安装,这就是为什么在该导入周围有一个 except 块捕获异常)但是而不是你将 python 3.4 指向了一些随机的 python 2 程序。

    如果你想运行 python 3.4,你需要创建一个安装了 Twisted 的 python 3 环境。请记住,并非所有 Twisted 都已移植,因此您只能使用一部分 API。尚未移植到 python 3 的东西之一是 twistd 命令行,所以还没有办法使用 python 3 运行 twistd

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-06-15
      • 2010-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多