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
3
votes
2 answers

ipdb commands obscured by variables

When i try to debug this sample script with ipdb: n = 1 next = 1 print('end') I can't execute line 3 because python variables obscure pdb commands: $ ipdb test.py > /tmp/test.py(1)() ----> 1 n = 1 2 next = 1 3…
Kossak
  • 1,273
  • 1
  • 16
  • 31
3
votes
1 answer

Itertools.product raises "Error in argument"

I am a bit lost here: I can not use itertools.product in my code. This is in a break point in unittest setUp method: ipdb> import itertools ipdb> itertools ipdb> itertools.product ipdb>…
zidarsk8
  • 3,088
  • 4
  • 23
  • 30
3
votes
1 answer

Home button bug in ipdb on Linux

Running a file consisting of the line import ipdb;ipdb.set_trace() then entering more than 19 or more arbitrary characters in the command line and then hitting Home button (or Ctrl-A) makes the cursor go to position 11 instead of position 0 of the…
Antony Hatchkins
  • 31,947
  • 10
  • 111
  • 111
3
votes
1 answer

Convenience function defined for debugging with ipdb in Python

At the top of my Python scripts I have defined the following convenience function for debugging with ipdb: def bp(): import ipdb ipdb.set_trace() So when I want to debug in a certain point I can write: bp() instead of having to write…
Daniel Arteaga
  • 467
  • 3
  • 9
3
votes
3 answers

Trouble Importing in Ipython: ImportError: No module named 'ipdb'

I've run pip install ipdb but when I run import ipdb in iPython I still get the error: ImportError: No module named 'ipdb' What does this mean? Similarly, when I'm importing files (with .py extension) in iPython, I'm also getting this error…
Erin Wolpert
  • 363
  • 1
  • 5
  • 8
3
votes
1 answer

python ipdb occasionally shows no code lines

Interrupting execution of python code with import ipdb; ipdb.set_trace() sometimes (but not always) drops me into ipdb without showing surrounding lines of code, even if I issue the l command. Ie, I get something like >…
Gerhard
  • 1,925
  • 3
  • 15
  • 24
3
votes
2 answers

ipdb / set_trace() bug on Windows?

I am getting a really strange output when running a python script and setting a break point with ipdb as in this program: import sys import ipdb parents, babies = (1, 1) while babies < 100: ipdb.set_trace() print 'This generation has {0}…
aegger
  • 342
  • 1
  • 2
  • 13
3
votes
0 answers

Show traceback of an exception raised by a manually invoked function in ipdb

ipdb> def aaaa(q): q[2] ipdb> aaaa([1,2,3,4]) ipdb> aaaa([]) *** IndexError: list index out of range ipdb> I want to have a full traceback displayed (pretty one - with stack frames, locals, etc.), not only '*** IndexError: list index out of range'.…
2
votes
1 answer

How to debug a function that has been passed as an argument to another function

I'm new to Python and used to debugging in R. I'm trying to debug my_function when it has been passed as an argument to another function df.apply(my_function, axis=1) When I use the debugger (I'm in Spyder V5) I can jump down into the apply…
2
votes
1 answer

How to print p variable inside ipdb

I have variable called p and I want to print its value inside ipdb. p = 100 breakpoint() # DEBUG ipdb> help p p expression Print the value of the expression. ipdb> p *** SyntaxError: unexpected EOF while parsing I can't to it since p…
alper
  • 2,919
  • 9
  • 53
  • 102
2
votes
1 answer

How to use PYTHONBREAKPOINT to start ipython?

I was trying to get the interactive ipython which can also make use of auto-complete by doing the following but somehow I see it starting ipdb instead and not being able to make use of auto-complete. pip install ipython pyreadline export…
sorin
  • 161,544
  • 178
  • 535
  • 806
2
votes
0 answers

Why Python's breakpoint and ipdb behave this way?

I'm used to debugging in Python with PyCharm. Now I'm trying to learn using ipdb with Jupyter(Lab to be precise). But the two following behaviors are really puzzling me ! First one breakpoint() for i in range(3): print(i) Then in the debugger…
Icarwiz
  • 184
  • 6
2
votes
2 answers

Enter sticky mode by default with ipdb

When debugging with ipdb, I find it useful to enter in sticky mode to follow the code source. Is there a way to enter automatically in sticky mode without having to type sticky?
BiBi
  • 7,418
  • 5
  • 43
  • 69
2
votes
0 answers

When added ipdb at flask app it raises RuntimeError: There is no current event loop in thread

Okay now I'm working on simple flask app and it is working but while working I needed ipdb at certain api, after I added it Traceback (most recent call last): File "/home/amir/Workspace/mmb/recsysenv/lib/python3.6/site-packages/flask/app.py",…
A.Raouf
  • 2,171
  • 1
  • 24
  • 36
2
votes
1 answer

Why does quitting ipdb while inside a cmd.Cmd subclass function exit the function?

I have a little cmd subclass: class Foo(cmd.Cmd): def do_ipdb(self, *a, **kw): import ipdb; ipdb.set_trace() pass Foo().cmdloop() This works and lets me inside ipdb, but when exiting, either using 'q' or CTRL-D, the cmdloop…
CIsForCookies
  • 12,097
  • 11
  • 59
  • 124