Questions tagged [ipdb]

Interactive Python Debugger, IPython-interface to pdb

ipdb exports functions to access the IPython debugger, which features tab completion, syntax highlighting, better tracebacks, better introspection with the same interface as the pdb module.

192 questions
21
votes
1 answer

Get reference to the current exception

$ ./runtests.py -v tests/managers/test_customer.py:CustomerManagerTest.test_register_without_subscription --ipdb ... test_register_without_subscription (tests.managers.test_customer.CustomerManagerTest) ... - TRACEBACK…
warvariuc
  • 57,116
  • 41
  • 173
  • 227
19
votes
2 answers

Use ipdb instead of pdb with py.test --pdb option

I want to use ipdb instead of pdb with py.test --pdb option. Is this possible? If so, how? Clearly, I can use import ipdb; ipdb.set_trace() in the code but that requires to run the test, watch it fail, open a file, find the point of failure in said…
Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
16
votes
1 answer

How to run pytest with an python debugger with tab completion?

Background I have been debugging my python scripts for ~2 years with plain from IPython import embed; embed(), and it has been working really fine. I just place the command on the line I want to examine, and when running the script I will have full…
Niko Föhr
  • 28,336
  • 10
  • 93
  • 96
14
votes
1 answer

ipdb stops showing prompt text after carriage return

Recently when setting up a breakpoint using ipdb.set_trace(context=20) I can see the command I'm inputing the first time, after hitting return, next time I write an instruction or command in my ipdb prompt is not showing. When I hit enter it…
maraujop
  • 4,472
  • 2
  • 36
  • 40
14
votes
3 answers

Jupyter notebook stuck in pdb mode

I'm using Jupyter (IPython) notebook, where pdb / ipdb runs fine, except for one problem: If I accidentally run the same cell that my pdb is in while in pdb mode, the output disappears, the entire notebook gets stuck and I can't run any more…
wkzhu
  • 1,616
  • 13
  • 23
14
votes
1 answer

Using ipdb with emacs' gud without explicit breakpoints in code

I'm using python.el If I choose 'debugger' from the menu, and enter 'python -m pdb myfile.py', gud starts, and in a split frame I see the (Pdb) prompt in one, and my python code in the other with a caret on the first line, indicating that it's ready…
garyp
  • 967
  • 7
  • 36
14
votes
2 answers

How to find the breakpoint numbers in pdb (ipdb)?

Trying to find how to execute ipdb (or pdb) commands such as disable. Calling the h command on disable says disable bpnumber [bpnumber ...] Disables the breakpoints given as a space separated list of bp numbers. So how whould I get those bp…
vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
14
votes
1 answer

ipython ipdb, when invoked via ipdb.set_trace(), does not remember the command history while debugging

iPython does remember the command history if I run ipython normally, e.g. to mess around testing basic things in the repl, but I would like to be able to pull up the debugging commands from the previous debug session, and I am doing my debugging by…
Steven Lu
  • 41,389
  • 58
  • 210
  • 364
12
votes
1 answer

Start python debugger in oldest stack frame after an exception occurs

I use the --pdb command with ipython, so when I'm debugging code and an error occurs it shows a stack trace. A lot of these errors come from calling numpy or pandas functions with bad inputs. the stack trace starts at the newest frame, in code…
user2699
  • 2,927
  • 14
  • 31
12
votes
3 answers

ipdb with python unittest module

Is there any convenient way to get an ipdb debugger on an exception, when running tests with python's unittest module? It's convenient to debug python code using ipython --pdb my_script.py. However, when I use the unittest module, with class…
John
  • 935
  • 6
  • 17
11
votes
4 answers

How to debug the stack trace that causes a subsequent exception in python?

Python (and ipython) has very powerful post-mortem debugging capabilities, allowing variable inspection and command execution at each scope in the traceback. The up/down debugger commands allow changing frame for the stack trace of the final…
user2561747
  • 1,333
  • 2
  • 16
  • 39
11
votes
2 answers

Is it possible to skip breakpoints in pdb / ipdb?

Is there a way to tell pdb or ipdb to skip all future break-points and just finish execution as if they weren't there?
capybaralet
  • 1,757
  • 3
  • 21
  • 31
11
votes
1 answer

ipdb how to bring the python debugger up to the frame which called the third-party code

In my python code, I have several levels of call stacks like this: f1:user_func1 f2:**user_func2** f3:third_party_func1 f4:third_party_func2 f5:exception happens here. An exception happens somewhere in the third-party code…
motam79
  • 3,542
  • 5
  • 34
  • 60
11
votes
3 answers

How can I extract local variables from a stack trace?

Suppose I have a function that raises unexpected exceptions, so I wrap it in ipdb: def boom(x, y): try: x / y except Exception as e: import ipdb; ipdb.set_trace() def main(): x = 2 y = 0 boom(x, y) if __name__…
Wilfred Hughes
  • 29,846
  • 15
  • 139
  • 192
11
votes
4 answers

How to automatically switch to debug mode on a warning?

I want to debug a warning that occurs well into the code's execution. A simple breakpoint won't do, because the line that results in the warning executes millions of times without warning before the first warning occurs. Also, the line where this is…
kjo
  • 33,683
  • 52
  • 148
  • 265
1
2
3
12 13