Weird behaviour re: Python on Windows

Kevin Jing Qiu kevin.jingqiu at caseware.com
Tue Jan 13 17:29:58 EST 2009


I've been experiencing weird behavior of Python's os module on Windows:

Here's the environment:
Box1: Running Windows 2003 Server with Apache+mod_python
Box2: Running Windows 2003 Server with Zope/Plone and Z:\ mapped to D:\
on Box1

It appears any os calls that deals with file/dir on the mapped drive is
problematic. More specifically, os.stat(path), os.path.exists(path)
gives 'File not found' when path is on the mapped drive. Wait, this gets
better: when I'm in the debug mode (or Python interactive shell),
everything works fine! Os.stat, os.path.exists, os.fstat, etc, worked as
expected. I tried PyWin32 extension's GetFileSize() method and the same
thing happens: debug or interactive mode works fine, but when Plone is
run in non-debug mode, the problems begin.

I swear this isn't a Plone problem either. I switched the configuration.
Now Box1 has a network drive mapped to Box2's D:\. The custom Apache
filter we have (which is written in python executed by mod_python)
complains that it can't find the file which is on the mapped drive.

So there you go. I'm wondering if anyone else experienced such problem.
Any suggestions or input is appreciated!

Thanks,

Kevin




More information about the Python-list mailing list