Bdbquit raised when debugging python -
recently when adding debugger python 2.7.10 code, message:
traceback (most recent call last): file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/queues/connectors/amqplib_connector.py", line 191, in acking_callback callback(message.body) file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/queues/consumable_message_queue.py", line 32, in deserialized_callback self._callback_method(msg) file "/users/isaachess/programming/vivint/platform/businesslogic/businesslogic/util/statsd_util.py", line 95, in _time_func retval = f(*args, **kwargs) file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/net/router.py", line 226, in handle try: file "/users/isaachess/programming/vivint/platform/messageprocessing/vivint_cloud/net/router.py", line 226, in handle try: file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/bdb.py", line 49, in trace_dispatch return self.dispatch_line(frame) file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/bdb.py", line 68, in dispatch_line if self.quitting: raise bdbquit bdbquit this after inserting lines:
import pdb; pdb.set_trace()
in code.
i cannot figure out why happening. i've read on bdb , bdbquit, cannot figure out why happening in code. can provide me hints of why happens in general? really want debugger working again.
if continue (pdb) prompt , allow code finish normally, wouldn't expect output traceback indicated, if quit pdb, quit command or ^d (eof), traceback occurs because there nothing catch bdbquit exception raised when debugger quits. in bdb.py self.quitting gets set true set_quit method (and finally clauses in various run methods). dispatch methods called trace_dispatch raise bdbquit when self.quitting true, , typical except: clause bdbquit simple pass statement; pdb inherits of gdb.
in short, exception handling used disable system trace function used debugger, when debugger interaction finishes early.
one way avoid traceback altogether use pdb differently. rather calling pdb.set_trace() code (and not handling bdbquit @ all), can invoke code within pdb (rather vice versa), @ point bdbquit exception handled intended pdb. allow choose breakpoint locations without modifying code (using pdb's break command). or can mix 2 approaches; run code under pdb, pdb.set_trace() calls , all, , calls breakpoints can remove modifying code.
you can invoke code within pdb using pdb command script invocation command line arguments, or python -m pdb.
Comments
Post a Comment