0

I am using Spyder

When I write these lines :

import ipdb;
ipdb.set_trace()

When I press n the program always returns me to the following interactive shell error

--Return--
None
> <ipython-input-1-606cc96bec96>(7)<module>()
      6 
----> 7 import ipdb; ipdb.set_trace()
      8 


ipdb> n
> /home/***/anaconda3/envs/***/lib/python3.7/site-packages/IPython/core/interactiveshell.py(3329)run_code()
   3328                 # Reset our crash handler in place
-> 3329                 sys.excepthook = old_excepthook
   3330         except SystemExit as e:


ipdb> 

If I run this same script from the Ubuntu console it works correctly.

Why it doesn't it work in my Spyder program ?

Pullie
  • 2,685
  • 3
  • 25
  • 31
Camilo
  • 39
  • 1
  • 3

1 Answers1

1

That's not an error. You're debugging IPython's guts.

You're not running your own program, or at least, not directly. You're running IPython, which is itself written in Python, and you're passing your code as input for IPython to run with exec. ipdb doesn't see a separation between your code and IPython itself; it's debugging the current Python program as a whole.

When you run your program directly from a shell, you're actually running your program, rather than running IPython.

user2357112
  • 260,549
  • 28
  • 431
  • 505