Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: a newbie's question
Jean-Michel Pichavant
3/11/2010 1:11:00 PM
PEYMAN ASKARI wrote:
> Hello
>
> I need some help dynamically reloading modules. As it turns out, it is
> not as simple as calling reload, as outlined here
>
http://pyunit.sourceforge.net/notes/relo...
>
> Is there builtin support for this? The example they gave does not seem
> to work for me, and I am unclear as to what PyUnit is.
>
> Thanks
>
>
> Peyman
>
Please don't top post.
As for your question, there's no built-in method to reload a module
because it is not possible (in a generic manner).
However if you *really* want to do it you can do it for your particular
module (and only for this one).
It is tough to explain though. You have to know perfectly the python
object model and I'm not familiar enough with it to do the explanation.
So:
1/ try to live without dynamic reload
2/ if you *really* require dynamic reload, you can try to execute the
module in a subprocess. That way, every time you start a new subprocess,
the last up to date version of the module is used
3/ reload the module and all it's related objects currently in memory,
this is painfull and there are many traps to fall into. I'll let someone
else answer this point.
JM
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: a newbie's question
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password