Isak La Fleur
Isak La Fleur

Reputation: 4668

debugger in ipython is not working

I trying to use the debugger in ipython 3.1 on my python 2.7.9 installation on Windows 7.

Here is an example script:

def works_fine():
    a = 5
    b = 6
    assert(a + b == 11)

def throws_an_exception():
    a = 5
    b = 6
    assert(a + b == 10)

def calling_things():
    works_fine()
    throws_an_exception()

calling_things()

I step into the code with %debug.

I go up with u

Then I add a breakpoint at line 12 with b 12

I press c

Then instead of the debugger runs continue it prints out "ipdb> c" instead of continue.. How should I solve this?

> <ipython-input-7-c95b844c9880>(9)throws_an_exception()
      8     b = 6
----> 9     assert(a + b == 10)
     10 

ipdb> u
> <ipython-input-7-c95b844c9880>(13)calling_things() 2    12     works_fine()
---> 13     throws_an_exception()
     14 

ipdb> b 12 Breakpoint 3 at <ipython-input-7-c95b844c9880>:12
ipdb> c

Upvotes: 1

Views: 224

Answers (1)

Isak La Fleur
Isak La Fleur

Reputation: 4668

I figured it out. I need to put the code in a file and run -d xxxx.py. After this the continue works fine!

run -d ch03/ipython_bug.py

Upvotes: 2

Related Questions