To make debugging easier with Ipython, I include the following at the beginning of my scripts
from IPython.Debugger import Tracer
debug = Tracer()
However, if I run my script from the command line using
$ python myscript.py
I am getting an error related to Ipython. Is there any way to do the following
if run_from_ipython():
from IPython.Debugger import Tracer
debug = Tracer()
That way, I only import the Tracer () function when I need it.
source
share