Python still remembers script after change and save
Chris Barker
chrishbarker at home.net
Mon Oct 29 15:22:02 EST 2001
Chris Liechti wrote:
> "Paul Brian" <paul1brian at yahoo.com> wrote in
> > I occasionally come across a situation where I have changed a file,
> > rerun the file in python but python still produces an error, quoting
> > the original file in the error string
>
> you're looking for the "reload" command
>
> 1. for the first usage type:
> import mymod
>
> 2. usage after modifications on mymod, type:
> reload(mymod)
If you are working in an IDE that is written in Python (IDLE, MacPython
IDE, PythonWin, etc.) you might want to do:
import mymod
reload(mymod)
Everywhere while you are developing, so you will be assured of always
getting a fresh version when you run your code.
When a module is stable, you can delete the reload()
-Chris
--
Christopher Barker,
Ph.D.
ChrisHBarker at home.net --- --- ---
http://members.home.net/barkerlohmann ---@@ -----@@ -----@@
------@@@ ------@@@ ------@@@
Oil Spill Modeling ------ @ ------ @ ------ @
Water Resources Engineering ------- --------- --------
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------
More information about the Python-list
mailing list