[issue6321] Reload Python modules when running programs
Cherniavsky Beni
report at bugs.python.org
Mon Aug 16 02:38:38 CEST 2010
Cherniavsky Beni <cben at users.sf.net> added the comment:
> As it happens, I do use Windows and almost exclusively start IDLE via right-clicks on .py files. I've never seen the behavior you describe documented anywhere.
You're right, it wasn't.
[IDLE does show a "==== No Subprocess ====" line in the IDLE shell when you launch it this way. Unfortunately, the significance of this (and of the absence of "====== Restart ======" lines on F5) wouldn't be obvious unless you followed IDLE development around 2.3... :-(]
If you're using Python up to 2.6/3.0, please fall back to starting IDLE from the Start menu → Programs → Python X.Y → IDLE, then use File→Open to open files.
Or upgrade to Python 2.7/3.1, where right click → Edit with IDLE was fixed [issue5847] to open IDLE in the fully-functional mode. Note however, that once you have an open IDLE, still want to use File→Open or you'll get *2* IDLEs running at once, each with its own shell.
In both cases you'll notice IDLE will *completely* restart the underlying Python each time you press F5. This eliminates any stale-module problems, but kills all variables and state you had; this might require a change of habits but in my experience it's well worth it.
[P.S. If you absolutely must have module reloading without killing the whole state, and you're willing to debug occasional issues, take a look at http://www.cherrypy.org/attachment/wiki/AutoReload/autoreload.py
and possibly http://www.codexon.com/posts/a-better-python-reload]
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6321>
_______________________________________
More information about the Python-bugs-list
mailing list