- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 pyside 构建 Qt 应用程序,但出现随机段错误。我安装了 faulthandler,如果不完整,调用堆栈是清晰的:
File "/home/lionel/Libs/python/ProcessGraph/process_graph/qtgraph.py", line 247 in itemChange
File "/home/lionel/Libs/python/ProcessGraph/process_graph/qtgraph.py", line 268 in mousePressEvent
File "/home/lionel/Libs/python/ProcessGraph/process_graph/qtgraph.py", line 87 in mousePressEvent
File "main.py", line 219 in main
File "main.py", line 223 in <module>
崩溃总是存在(在 mousePressEvent 中),但我看不到除了启动 gdb 之外我还能做什么。
我已经安装了 python-gdb 并尝试启动:gdb -ex r --args python-dbg main.py
但它没有运行。所以我有点卡住了。这里的堆栈:
python2.7-dbg: ../Objects/object.c:65: _Py_AddToAllObjects: Assertion `(op->_ob_prev == ((void *)0)) == (op->_ob_next == ((void *)0))' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff6f09037 in raise ()
from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff6f09037 in raise ()
from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff6f0c698 in abort ()
from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6f01e03 in ?? ()
from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff6f01eb2 in __assert_fail ()
from /lib/x86_64-linux-gnu/libc.so.6
#4 0x0000000000488f38 in _Py_AddToAllObjects (
op=<unknown at remote 0x7ffff578aa20>, force=0)
at ../Objects/object.c:65
#5 0x00000000004bbde5 in PyType_Ready (
type=0x7ffff578aa20 <SbkEnumType_Type>)
at ../Objects/typeobject.c:3985
#6 0x00007ffff5567e50 in Shiboken::init() ()
from /usr/lib/x86_64-linux-gnu/libshiboken-python2.7.so.1.1
#7 0x00007ffff5577b79 in Shiboken::Module::create(char const*, void*) ()
from /usr/lib/x86_64-linux-gnu/libshiboken-python2.7.so.1.1
#8 0x00007ffff0c98fb9 in initQtCore ()
from /usr/lib/python2.7/dist-packages/PySide/QtCore.so
#9 0x0000000000549771 in _PyImport_LoadDynamicModule
(name=0xc37900 "PySide.QtCore",
pathname=0xc38930 "/usr/lib/python2.7/dist-packages/PySide/QtCore.so", fp=0xc3a980)
at ../Python/importdl.c:53
#10 0x0000000000545984 in load_module (
name=0xc37900 "PySide.QtCore", fp=0xc3a980,
pathname=0xc38930 "/usr/lib/python2.7/dist-packages/PySide/QtCore.so", type=3, loader=0x0)
at ../Python/import.c:1915
#11 0x0000000000547ade in import_submodule (
mod=<module at remote 0xbe2af0>,
subname=0xc37907 "QtCore",
fullname=0xc37900 "PySide.QtCore")
at ../Python/import.c:2700
#12 0x00000000005470ae in load_next (
mod=<module at remote 0xbe2af0>,
altmod=<module at remote 0xbe2af0>,
p_name=0x7fffffffcee8,
buf=0xc37900 "PySide.QtCore",
p_buflen=0x7fffffffcf00)
at ../Python/import.c:2515
#13 0x000000000054632e in import_module_level (
name=0x0,
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
locals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, fromlist=['__doc__'],
level=0) at ../Python/import.c:2232
#14 0x0000000000546805 in PyImport_ImportModuleLevel (
name=0xc86c3c "PySide.QtCore",
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
locals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, fromlist=['__doc__'],
level=0) at ../Python/import.c:2288
#15 0x000000000051208b in builtin___import__ (
self=0x0,
args=('PySide.QtCore', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ['__doc__'], 0), kwds=0x0) at ../Python/bltinmodule.c:49
---Type <return> to continue, or q <return> to quit---
#16 0x0000000000487ae4 in PyCFunction_Call (
func=<built-in function __import__>,
arg=('PySide.QtCore', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ['__doc__'], 0), kw=0x0) at ../Objects/methodobject.c:85
#17 0x0000000000427737 in PyObject_Call (
func=<built-in function __import__>,
arg=('PySide.QtCore', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ['__doc__'], 0), kw=0x0) at ../Objects/abstract.c:2529
#18 0x000000000042788d in call_function_tail (
callable=<built-in function __import__>,
args=('PySide.QtCore', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ['__doc__'], 0)) at ../Objects/abstract.c:2561
#19 0x00000000004279f9 in PyObject_CallFunction (
callable=<built-in function __import__>,
format=0x6412f7 "OOOOi")
at ../Objects/abstract.c:2585
#20 0x00000000005483e5 in PyImport_Import (
module_name='PySide.QtCore')
at ../Python/import.c:2886
#21 0x00000000005460cc in PyImport_ImportModule (
name=0x7ffff6796c67 "PySide.QtCore")
at ../Python/import.c:2129
#22 0x00007ffff5577b38 in Shiboken::Module::import(char const*) ()
from /usr/lib/x86_64-linux-gnu/libshiboken-python2.7.so.1.1
#23 0x00007ffff65a7cd6 in initQtGui ()
from /usr/lib/python2.7/dist-packages/PySide/QtGui.so
#24 0x0000000000549771 in _PyImport_LoadDynamicModule
(name=0xc209a0 "PySide.QtGui",
pathname=0xc235a0 "/usr/lib/python2.7/dist-packages/PySide/QtGui.so", fp=0xc09660)
at ../Python/importdl.c:53
#25 0x0000000000545984 in load_module (
name=0xc209a0 "PySide.QtGui", fp=0xc09660,
pathname=0xc235a0 "/usr/lib/python2.7/dist-packages/PySide/QtGui.so", type=3, loader=0x0)
at ../Python/import.c:1915
#26 0x0000000000547ade in import_submodule (
mod=<module at remote 0xbe2af0>,
subname=0xbe4a94 "QtGui",
fullname=0xc209a0 "PySide.QtGui")
at ../Python/import.c:2700
#27 0x000000000054766c in ensure_fromlist (
mod=<module at remote 0xbe2af0>,
fromlist=('QtGui',), buf=0xc209a0 "PySide.QtGui",
buflen=6, recursive=0) at ../Python/import.c:2606
#28 0x000000000054672a in import_module_level (
name=0x0,
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
locals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, fromlist=('QtGui',),
level=-1) at ../Python/import.c:2269
#29 0x0000000000546805 in PyImport_ImportModuleLevel (
name=0xbe4a34 "PySide",
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
locals={'__builtins__': <module at remote 0x7ffff7f---Type <return> to continue, or q <return> to quit---
cd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, fromlist=('QtGui',),
level=-1) at ../Python/import.c:2288
#30 0x000000000051208b in builtin___import__ (
self=0x0,
args=('PySide', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ('QtGui',)), kwds=0x0) at ../Python/bltinmodule.c:49
#31 0x0000000000487ae4 in PyCFunction_Call (
func=<built-in function __import__>,
arg=('PySide', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ('QtGui',)),
kw=0x0) at ../Objects/methodobject.c:85
#32 0x0000000000427737 in PyObject_Call (
func=<built-in function __import__>,
arg=('PySide', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ('QtGui',)),
kw=0x0) at ../Objects/abstract.c:2529
#33 0x0000000000527948 in PyEval_CallObjectWithKeywords (func=<built-in function __import__>,
arg=('PySide', {'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, {...}, ('QtGui',)),
kw=0x0) at ../Python/ceval.c:3890
#34 0x0000000000521c54 in PyEval_EvalFrameEx (
f=Frame 0xc092f0, for file main.py, line 7, in <module> (), throwflag=0) at ../Python/ceval.c:2333
#35 0x0000000000525989 in PyEval_EvalCodeEx (
co=0xbc2510,
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
locals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, args=0x0, argcount=0,
kws=0x0, kwcount=0, defs=0x0, defcount=0,
closure=0x0) at ../Python/ceval.c:3253
#36 0x000000000051b9f6 in PyEval_EvalCode (
co=0xbc2510,
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
locals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}) at ../Python/ceval.c:667
#37 0x000000000055842d in run_mod (mod=0xc1c1a8,
filename=0x7fffffffe1a8 "main.py",
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
locals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, flags=0x7fffffffdc10,
arena=0xb7f8a0) at ../Python/pythonrun.c:1365
#38 0x00000000005583b3 in PyRun_FileExFlags (
fp=0xc05370, filename=0x7fffffffe1a8 "main.py",
start=257,
globals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None},
---Type <return> to continue, or q <return> to quit---
locals={'__builtins__': <module at remote 0x7ffff7fcd4d8>, '__file__': 'main.py', '__package__': None, 'sys': <module at remote 0x7ffff7fcd610>, '__name__': '__main__', '__doc__': None}, closeit=1,
flags=0x7fffffffdc10)
at ../Python/pythonrun.c:1351
#39 0x0000000000556b70 in PyRun_SimpleFileExFlags (
fp=0xc05370, filename=0x7fffffffe1a8 "main.py",
closeit=1, flags=0x7fffffffdc10)
at ../Python/pythonrun.c:943
#40 0x0000000000556201 in PyRun_AnyFileExFlags (
fp=0xc05370, filename=0x7fffffffe1a8 "main.py",
closeit=1, flags=0x7fffffffdc10)
at ../Python/pythonrun.c:747
#41 0x000000000057203a in Py_Main (argc=2,
argv=0x7fffffffde28) at ../Modules/main.c:640
#42 0x0000000000417edc in main (argc=2,
argv=0x7fffffffde28) at ../Modules/python.c:23
最佳答案
有一个技巧,你必须启动对应于你的virtualenv的系统Python解释器。
此外,您还必须确保您使用的是 Python 的调试版本。
以下是我如何在 Ubuntu 上获得具有 python 特性的 gdb:
# must use debug build of Python
sudo apt-get install gdb python2.7-dbg
# newest kernels disallow tracing/debugging by default (why on earth?)
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
# create virtualenv with debug Python build
virtualenv -p /usr/bin/python2.7-dbg ~/labarret
# start virtualenv
. ~/labarret/bin/activate
# pip install your-libs-and-deps
# now start **system** interpreter that corresponds to virtualenv
# make sure virtualenv libs/modules are loaded via environment
PYTHONHOME=~/labarret/ gdb --args /usr/bin/python2.7-dbg your-code.py
关于python - 如何在 virtualenv 中调试 pyside 段错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19146706/
我有一个相对较大的项目,有很多依赖项,我想分发这个项目,但是安装这些依赖项有点痛苦,并且需要很长时间(pip install 需要相当长的时间)。所以我想知道是否有可能将整个 virtualenv 迁
我有一个 heroku 项目,我想与其他人分享。作为the instructions describe ,我使用 virtualenv 来管理环境和依赖项。有没有办法在新机器上从 requiremen
当我被迫更改我的项目目录名称时,我遇到了一个问题。 首先 Virtualenvwrapper 没有看到我的项目,所以我将 WORKON_HOME 的环境变量更改为新的项目目录。然后我可以激活我的环境。
你可以cd到YOUR_ENV/lib/pythonxx/site-packages/看看,但是有什么方便的方法吗? pip freeze 列出所有已安装的软件包,包括系统环境的软件包。 最佳答案 您可
我想使用 tox 在需要额外设置的项目上运行 py.test 除了将包安装到 virtualenv 之外。创建 virtualenv 并安装依赖项后,需要运行一些命令。 具体来说,我说的是使用 nod
背景:我正在 Mac OS High Sierra 上开发 Flaskr Web 项目。 正处于安装 Flask 阶段,我在安装 virtualenv 时遇到了问题: http://flask.poc
我在我的 ubuntu 电脑上制作了我的 virtualenv。我在那里开发了我的项目。 但我需要 move 我的环境,因为它包含所有包。因为目标机器无法通过网络连接到外部。我必须通过 USB mov
我在激活 virtualenv 时遇到问题。我在服务器上工作并使用 SSH 安全外壳。 我的最终目标是激活 virtualenv 并运行最新版本的 tensorflow 命令行如下: jeonguyo
我的 ~/Documents 中有一堆项目.我几乎只在 python 中工作,所以这些基本上都是 python 项目。每一个,例如~/Documents/foo有自己的 virtualenv,~/Do
我有 --no-site-packages 的 virtualenv选项。我在里面使用了scrapy。 Scrapy 通过 import libxml2 使用 libxml2 .如何使用 pip 在
在 virtualenvwrapper 中,有没有一种简单的方法可以列出我的计算机上的所有 virtualenv? (就像 yolk -l 那样列出当前虚拟环境中的所有 python 包?) 澄清:
本页命令行指令 https://github.com/plumi/plumi.app/blob/master/docs/INSTALL.rst 是“虚拟环境”。 即空格后有句号。 我找不到以这种方式在
我们可以创建一个 virtualenv 吗?从现有的 virtualenv 继承已安装的库? 详细说明: 我首先创建一个“引用”virtualenv,并添加库(固定版本): virtualenv re
我正在使用 sphinx记录我的软件。我正在使用 virtualenv用于安装。现在有些包只安装在虚拟环境中,sphinx 看不到。 我的 conf.py 中有此代码: # If extensions
这个问题在这里已经有了答案: Can existing virtualenv be upgraded gracefully? (5 个回答) 2年前关闭。 我已经使用 python 3.6 创建了一个
这看起来应该很简单: tasks: - name: install python packages pip: name=${item} virtualenv=~/buildbot-env wi
我已经看到了一些针对此问题的修复,但没有一个对我有用,但我认为是我的 virtualenvs 损坏了。我刚刚从 12.04 升级到 14.04,现在我所有的金字塔应用程序都不再工作了。 当我运行 ..
假设我有以下设置: mkdir test && cd test virtualenv .venv source .venv/bin/activate pip install django mkdir
我从 Github 帐户克隆了我的 Django 项目,并使用著名的命令 source nameofenv/bin/activate 激活了 virtualenv当我运行 python manage.
不久前我用 uwsgi/nginx 设置了一个 flask 站点,并设置了一个 virtualenv .. 我忘记了我设置的 venv 的名称,我找不到任何方法在当前目录中列出 virtualenv
我是一名优秀的程序员,十分优秀!