Importing the module breaks the interpreter
When the module is imported in the python interpreter, which can be done not only explicitly, but also just by doing e.g. help(modules), some kind of ipython shell replaces the interpreter. If that can be avoided it is a good thing to do.
Could you provide a simple test case?
@gnebehay "import ipdb" in /usr/bin/python
python
Python 3.5.3rc1 (default, Jan 3 2017, 04:40:57)
[GCC 6.3.0 20161229] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipdb
Enabling autoreload.
Importing numpy, pyplot and pandas libraries
Using matplotlib backend: TkAgg
In :
Seems reproducable. Creating the IPython terminal should probably be deferred until debugging actually starts.
@gnebehay , I noticed that when you executed import ipdb, it mentioned Enabling autoreload. How are you doing this?
I am trying to figure out how to autoload code while executing code through
ipdb.
I have the following statement in my python code
import ipdb; ipdb.set_trace()
If I load the autoload extension using
https://ipython.org/ipython-doc/3/config/extensions/autoreload.html
and then attempt to run my python function which contains the set_trace()
statement from above, will ipdb automatically reload the code in the
modules on each n, j while executing each line of code?
This is actually due to my IPython profile, where I use the package to autoreload files while I am using the IPython shell. These are the relevant settings: https://github.com/gnebehay/common/blob/master/dotfiles/.ipython/profile_default/ipython_config.py I don't think that this package can swap code on-the-fly during debugging, but maybe there are other packages for this purpose.
Thanks for the clarification. I will see if I can find any..
I think this has been fixed, probably in 0.13.7?