Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing the module breaks the interpreter #120

Open
wRAR opened this issue Oct 30, 2016 · 7 comments
Open

Importing the module breaks the interpreter #120

wRAR opened this issue Oct 30, 2016 · 7 comments

Comments

@wRAR
Copy link

wRAR commented Oct 30, 2016

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.

@gnebehay
Copy link
Collaborator

Could you provide a simple test case?

@wRAR
Copy link
Author

wRAR commented Jan 20, 2017

@gnebehay "import ipdb" in /usr/bin/python

@gnebehay
Copy link
Collaborator

gnebehay commented Jan 20, 2017

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.

@alphaCTzo7G
Copy link

@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?

@gnebehay
Copy link
Collaborator

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.

@alphaCTzo7G
Copy link

Thanks for the clarification. I will see if I can find any..

@wRAR
Copy link
Author

wRAR commented Dec 12, 2021

I think this has been fixed, probably in 0.13.7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants