rocksportrocker
rocksportrocker

Reputation: 7419

How to run Python debugger for a Python console application which raises an exception

If I start ipython notebook from the command line IPython throws an exception with a long traceback and I want to run a debugger at the point where the exception is thrown.

I know IPythons magic command %debug but this requires a Python script as argument. My current solution is insert import IPython; IPython.embedd() or import pdb; pdb.set_trace() manually, but I wonder if there is a better and noninstruive solution for this.

Is there a way to start the Python debugger automatically for command line tools which are implemented with setuptools entry point mechanism ?

Upvotes: 1

Views: 325

Answers (1)

Stefano Sanfilippo
Stefano Sanfilippo

Reputation: 33046

IPython launcher is a Python script itself, so just run it in Python debugger:

python -m pdb /usr/bin/ipython notebook

Upvotes: 3

Related Questions