reloading modules question
Dale Strickland-Clark
dale at out-think.NOSPAMco.uk
Sat Dec 9 11:12:28 EST 2000
"Syver Enstad" <syver at NOSPAMcyberwatcher.com> wrote:
>Is it safe to loop through sys.modules.items()
>reloading each module, as long as I catch the ImportError?
>
>Am I guaranteed to have all python modules reloaded if I do the loop twice?
>
>import sys
>for key, value in sys.modules.items():
> if value:
> try:
> reload(value)
> except ImportError, e:
> print '%s\n' % e
>
>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.
>
I would suggest you are better off just stopping and starting the affected web sites. That's what we
do and it only takes a second.
You can automate the procedure using WMI or ADSI. I'm sure I used to have an example script but I'm
buggered if I can find it right now.
Try asking over in microsoft.public.scripting.wsh.
--
Dale Strickland-Clark
Out-Think Ltd
Business Technology Consultants
More information about the Python-list
mailing list