How to get a running process to recompile certain scripts
Bjorn Pettersen
BPettersen at NAREX.com
Wed Jan 22 12:30:18 EST 2003
> From: Paul Mackinney [mailto:paul at mackinney.net]
>
> I'm tinkering with a custom archiver for Mailman. My scripts
> are getting
> called just fine, but I'd like to be able to update them
> without having
> to halt Mailman.
[...]
> # PaulArchiver.py
> sys.path.append(<my working dir>)
>
> def PaulArchive.py(mailinglist, message):
> MyWorkingScript(<params>)
>
> The thing I don't know how to do is to have changes to the scripts in
> <my working dir> recompiled without restarting Mailman since it's a
> working server for other lists (that use the regular archiver).
Try:
import PaulArchive
reload(PaulArchive)
PaulArchive.doSomething()
it will only work for code you execute after the reload, i.e. if you
have handles to e.g. functions in your module they won't get
refreshed...:
a = PaulArchive.a
reload(PaulArchive)
a(...) # calls the old a
PaulArchive.a(...) # calls the new a
-- bjorn
More information about the Python-list
mailing list