[PyQt] Re: /NewThread/, and Python stack in Visual Studio
Kevin Watters
kevinwatters at gmail.com
Mon Jun 23 22:55:42 BST 2008
> > Anyone lucky enough to be using Visual Studio for their SIP projects have any
> > advice on the Python stack trace issue?
>
> Not that I know of, but please let me know if you find out something.
The best I could come up with was to wrap my main loop in an SEH block
(lookup __try and __except) so that I'd catch access violations and
other similar exceptions, and then in the handler, attempt to call back
into this Python function:
import sys
from traceback import format_stack
def where():
for thread_id, frame in sys._current_frames().iteritems():
print '\n%s\n\n%s\n\n\n' % (thread_id, ''.join(format_stack(frame)))
That will at least attempt to dump the Python stacks of each running
thread out to stdout -- and you can match thread IDs up with the ones
in Visual Studio's debugger. It definitely doesn't always work--but it
has helped me track down a few of the bad crashes.
- Kevin
More information about the PyQt
mailing list