reloading modules question
Martin von Loewis
loewis at informatik.hu-berlin.de
Sat Dec 9 05:52:47 EST 2000
"Syver Enstad" <syver at NOSPAMcyberwatcher.com> writes:
> Is it safe to loop through sys.modules.items()
> reloading each module, as long as I catch the ImportError?
What do you mean by "safe"? Python will continue to work, if that is
what you mean.
> Am I guaranteed to have all python modules reloaded if I do the loop twice?
No. Reloading a builtin module does not do anything.
> The reason I am asking is that IIS webserver keeps Python in memory
> so that it won't use the new versions of python modules I deploy if
> don't stop and start the webserver. I can't afford to stop the
> webserver all the time, so I am considering ways to reload the
> python modules while it's running.
Which of your modules require reloading when they are reused? I
recommend to redesign the modules so that they act as libraries,
instead of keeping session state.
Regards,
Martin
More information about the Python-list
mailing list