[mod_python] Force reload?

Gregory (Grisha) Trubetskoy grisha at modpython.org
Fri Feb 4 10:33:37 EST 2005

On Thu, 3 Feb 2005, Graham Dumpleton wrote:

> Shawn Harrison wrote ..
>> Is there any reason I'm not seeing why this function won't solve the
>> reload problem, if used in place of all import statements in the
>> application?

I'm not too keen on "solving the reload prolem" because no matter how 
clever mechanism, reload has some inherent problems, e.g.:

$ cat foo.py

A = [1,2,3]
B = [2,3,4]

$ python
Python 2.3.3 (#1, May  7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo
>>> foo.A
[1, 2, 3]
>>> x = foo.A
>>> ^Z

[here i edit foo.py and comment out A]

>>> foo = reload(foo)
>>> foo.A
[1, 2, 3]

so as you see A is still there. So you're bound to have to restart your 
server at some point. IMO the reload mechanism should be sufficient enough 
to avoid having to restart httpd all of the time, but the developer still 
needs to understand how Python works and realize that some situation are 
only solved by a restart.


More information about the Mod_python mailing list