擅长:python、mysql、java
<p>我必须在跟踪点使用“next”命令才能首先脱离该函数。为此,我修改了mgrandi的代码:</p>
<pre><code>def pyqt_set_trace():
'''Set a tracepoint in the Python debugger that works with Qt'''
from PyQt4.QtCore import pyqtRemoveInputHook
import pdb
import sys
pyqtRemoveInputHook()
# set up the debugger
debugger = pdb.Pdb()
debugger.reset()
# custom next to get outside of function scope
debugger.do_next(None) # run the next command
users_frame = sys._getframe().f_back # frame where the user invoked `pyqt_set_trace()`
debugger.interaction(users_frame, None)
</code></pre>
<p>这对我有效。我从这里找到了解决方案:<a href="https://stackoverflow.com/questions/2596738/python-pdb-queueing-up-commands-to-execute">Python (pdb) - Queueing up commands to execute</a></p>