Gregory (Grisha) Trubetskoy
grisha at modpython.org
Mon Oct 15 18:46:50 EST 2001
The problem isn't with the "[:-1]", it's that os.path.exists() *raises* an error. It's not supposed to raise errors, just return true or false (at least according to documentation): http://www.python.org/doc/current/lib/module-os.path.html This is a Python bug that begins in 2.1 and is still in 2.2a1, but seems to be fixed in 2.2a4. This is also in the mod_python FAQ, and there is a link there to a patch ;-) http://www.modpython.org/FAQ/faqw.py?req=all#2.3 Grisha On Mon, 15 Oct 2001, Ole Hansen wrote: > Hi, > > I still have a reload problem when using mod_python. From the error_log below > it can be seen (last line) that apache searches for a file called 'myfile.p'. > What happend to the last 'y' in '.py' ? > > I'm still using my homemade workaround, but I'm not sure this is the right > way to do it. I'm using python 2.2.1 and I have just installed mod_python > 2.7.6 and apache 1.3.20, but the reload problem is still there. Is this > really only a problem on my system? > > My homemade workaround in apache.py (line 356,359) is as follows: > > # check also .py and take the newest > ## if os.path.exists(filepath[:-1]) : > if os.path.exists(filepath[:]): > > # get the time of the .py file > ## mod = os.stat(filepath[:-1]) > mod = os.stat(filepath[:]) > mtime = max(mtime, mod[stat.ST_MTIME]) > > > In filepath[:-1] I have just removed '-1'. Well, it works for me at the > moment, but I'm afraid that someday nothing will work because of this > modification. Could there be something else wrong with my configuration? If > anybody have an idea I'm happy to hear about it. > > Thanks in advance! > Br. > Ole Hansen > > > error_log: (with original apache.py) > ---------------------------------------- > [Mon Oct 15 22:49:15 2001] [error] PythonHandler mod_python.publisher: > Traceback (most recent call last): > [Mon Oct 15 22:49:15 2001] [error] PythonHandler mod_python.publisher: File > "/usr/local/lib/python2.1/site-packages/mod_python/apache.py", line 193, in > Dispatch > result = object(req) > [Mon Oct 15 22:49:15 2001] [error] PythonHandler mod_python.publisher: File > "/usr/local/lib/python2.1/site-packages/mod_python/publisher.py", line 128, > in handler > module = apache.import_module(module_name, _req, [path]) > [Mon Oct 15 22:49:15 2001] [error] PythonHandler mod_python.publisher: File > "/usr/local/lib/python2.1/site-packages/mod_python/apache.py", line 356, in > import_module > if os.path.exists(filepath[:-1]) : > [Mon Oct 15 22:49:15 2001] [error] PythonHandler mod_python.publisher: File > "/usr/local/lib/python2.1/posixpath.py", line 171, in exists > st = os.stat(path) > [Mon Oct 15 22:49:15 2001] [error] PythonHandler mod_python.publisher: > OSError: [Errno 2] No such file or directory: > '/usr/local/apache/htdocs/myfile.p' > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://www.modpython.org/mailman/listinfo/mod_python >
|