调试时python-dbg找不到Py_InitModule4

时间:2012-08-23 19:27:39

标签: python gdb python-2.7 ubuntu-12.04

我正在尝试调试我在多线程的qt webkit应用程序中获得的段错误。我安装了python-dbg,目的是让我在gdb中进行漂亮的打印,并在启动时收到以下错误

python2.7-dbg node.py
Traceback (most recent call last):
  File "node.py", line 4, in <module>
    import msgpack
  File "/usr/lib/pymodules/python2.7/msgpack/__init__.py", line 3, in <module>
    from msgpack._msgpack import *
ImportError: /usr/lib/pymodules/python2.7/msgpack/_msgpack.so: undefined symbol: Py_InitModule4
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
    from apport.report import Report
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 20, in <module>
    import apport.fileutils
  File "/usr/lib/python2.7/dist-packages/apport/fileutils.py", line 22, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python2.7/dist-packages/apport/packaging_impl.py", line 20, in <module>
    import apt
  File "/usr/lib/python2.7/dist-packages/apt/__init__.py", line 21, in <module>
    import apt_pkg
ImportError: /usr/lib/python2.7/dist-packages/apt_pkg.so: undefined symbol: Py_InitModule4

Original exception was:
Traceback (most recent call last):
  File "node.py", line 4, in <module>
    import msgpack
  File "/usr/lib/pymodules/python2.7/msgpack/__init__.py", line 3, in <module>
    from msgpack._msgpack import *
ImportError: /usr/lib/pymodules/python2.7/msgpack/_msgpack.so: undefined symbol: Py_InitModule4

当我运行不使用msgpack的脚本版本时,我得到同样的东西......

Traceback (most recent call last):
  File "scraper.py", line 2, in <module>
    from planeswalker import PlaneswalkerParser
  File "/var/www/rails_projects/MCPro.com/lib/planeswalker/planeswalker.py", line 2, in <module>
    from PyQt4.QtCore import *
ImportError: /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so: undefined symbol: Py_InitModule4
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
    from apport.report import Report
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 20, in <module>
    import apport.fileutils
  File "/usr/lib/python2.7/dist-packages/apport/fileutils.py", line 22, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python2.7/dist-packages/apport/packaging_impl.py", line 20, in <module>
    import apt
  File "/usr/lib/python2.7/dist-packages/apt/__init__.py", line 21, in <module>
    import apt_pkg
ImportError: /usr/lib/python2.7/dist-packages/apt_pkg.so: undefined symbol: Py_InitModule4

Original exception was:
Traceback (most recent call last):
  File "scraper.py", line 2, in <module>
    from planeswalker import PlaneswalkerParser
  File "/var/www/rails_projects/MCPro.com/lib/planeswalker/planeswalker.py", line 2, in <module>
    from PyQt4.QtCore import *
ImportError: /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so: undefined symbol: Py_InitModule4

在这两种情况下它看起来都是Py_InitModule4 ...任何想法python专家?使用普通的python 2.7

,代码运行正常(段后失效除外)

如果有更简单的方法在gdb中进行漂亮的打印,我也会对此持开放态度。基本上只是寻找一个python风格的堆栈跟踪

1 个答案:

答案 0 :(得分:2)

经过一番戳之后,看起来在过去的ubuntu python-dbg库中存在与此相关的错误。我提起了一个错误的诉讼,发现我只是没有阅读文档。需要安装-dbg版本的库(在本例中为MySQLdb和PyQT4)

消息包没有版本,所以我发布了另一个关于如何做到这一点的问题

此处的错误报告标记为无效参考https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1040914