Fw: automatic reload

A

Alan Baljeu

Alan Baljeu
http://www.collaborative-systems.org
Intelligent software that works _with_ you.



----- Forwarded Message ----
From: Alan Baljeu <[email protected]>
To: Mike Driscoll <[email protected]>
Sent: Friday, November 14, 2008 2:06:26 PM
Subject: Re: automatic reload

I thought I was reading something specific was made for unittest, although I can't find it now. TurboGears I don't know much about. I'm concerned its reload is specialized for a certain type of file (page generators?) and might not be suitable in general.


The other option I was suggessting PyInitialize and Py_Finalize. Finalize comes with a scary list of issues, which basically say things may fail and memory may leak. I notice also Py_NewInterpreter/Py_EndInterpreter does about the same thing for me. Maybe that's the way to go. But these caveats scare me:



Also note that the use of this functionality is incompatible with extension
modules such as PyObjC and ctypes that use the PyGILState_* APIs (and
this is inherent in the way the PyGILState_* functions work). Simple
things may work, but confusing behavior will always be near.I'm not sure what these are, but they sound like what I would use in embedding the interpreter. But then again, this is a C function designed for embedding. How could this be a problem?




Alan Baljeu




----- Original Message ----
From: Mike Driscoll <[email protected]>
To: (e-mail address removed)
Sent: Friday, November 14, 2008 12:08:06 PM
Subject: Re: automatic reload

I need a solution for automatically reloading files I edited. This is in a unit testing/fixing context, so there shouldn't be much problem with leftover data. I just need to be able to call a reload_changed() method of some sort before rerunning tests. Stopping and restarting the python interpreter (it's embedded) might be an option if (a) that's feasible within a process and (b) it's quick.

Alan Baljeuhttp://www.collaborative-systems.org
Intelligent software that works _with_ you.

There's the "reload" builtin that you could use. In your method, just
call reload on the modules you need reloaded. TurboGears somehow
watches files for changes, so you might want to check out their source
to see how it works. I'm sure it's something similar.

Mike
--
http://mail.python.org/mailman/listinfo/python-list



__________________________________________________________________
Get a sneak peak at messages with a handy reading pane with All new Yahoo! Mail: http://ca.promos.yahoo.com/newmail/overview2/



__________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top