473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Fw: automatic reload



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

----- Forwarded Message ----
From: Alan Baljeu <al********@yahoo.com>
To: Mike Driscoll <ky******@gmail.com>
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 <ky******@gmail.com>
To: py*********@python.org
Sent: Friday, November 14, 2008 12:08:06 PM
Subject: Re: automatic reload

On Nov 14, 11:04 am, Alan Baljeu <alanbal...@yahoo.comwrote:
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/
Nov 14 '08 #1
0 1487

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

66
by: Ellinghaus, Lance | last post by:
> > Other surprises: Deprecating reload() >Reload doesn't work the way most people think >it does: if you've got any references to the old module, >they stay around. They aren't replaced. ...
1
by: Emmanuel | last post by:
Hi, I use a 'reload all' feature in my app, that allow to reload every module. I first try this version : import sys def Reload():
2
by: JR | last post by:
Is there a script available to automatically reload images on visiting a page? I change images once a week and they have the same name so I'm not changing the page code. Some people have the...
1
by: Federico | last post by:
I want to create an automatic log system that writes to a ofstream (the logfile) all the output sent to screen. I tried to make a class COutput with the operator << overloaded for the different...
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
4
by: Lonnie Princehouse | last post by:
So, it turns out that reload() fails if the module being reloaded isn't in sys.path. Maybe it could fall back to module.__file__ if the module isn't found in sys.path?? .... or reload could...
7
by: fh | last post by:
hello! I 've a found way to reload my page automatically every n seconde using this code Response.AppendHeader("Refresh", "4"); it works fine but I wish to do the same with only a part of my...
9
by: andrewfelch | last post by:
Hello all, I'm using the metaclass trick for automatic reloading of class member functions, found at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 My problem is that if I 1)...
8
praclarush
by: praclarush | last post by:
Ok, I'm new to JavaScript and I'm taking a class for it the assignment in it I'm supposed to create edit a pre-made page to display a marquee that automatically scrolls for the user, as well as give...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.