ipdb

Bdbquit raised when debugging python

醉酒当歌 提交于 2019-11-27 13:41:55
问题 Recently when adding the debugger to my python 2.7.10 code, I get this 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

using ipdb to debug python code in one cell (jupyter or Ipython)

戏子无情 提交于 2019-11-27 09:10:59
问题 I'm using jupyter (or Ipython) notebook with firefox, and want to debug some python code in the cell. I am using 'import ipdb; ipdb.set_trace()' as kind of breakpoint, for example my cell has the following code: a=4 import ipdb; ipdb.set_trace() b=5 print a print b which after execution with Shift+Enter gives me this error: -------------------------------------------------------------------------- MultipleInstanceError Traceback (most recent call last) <ipython-input-1-f2b356251c56> in

Convert generator object to list for debugging [duplicate]

ε祈祈猫儿з 提交于 2019-11-27 00:09:23
问题 This question already has an answer here: Fastest way to convert an iterator to a list 2 answers When I'm debugging in Python using IPython, I sometimes hit a break-point and I want to examine a variable that is currently a generator. The simplest way I can think of doing this is converting it to a list, but I'm not clear on what's an easy way of doing this in one line in ipdb , since I'm so new to Python. 回答1: Simply call list on the generator. lst = list(gen) lst Be aware that this affects