[Python-Dev] Special file "nul" in Windows and os.stat

Facundo Batista facundobatista at gmail.com
Wed Oct 24 22:23:55 CEST 2007

Hi, people!

I'm following the issue 1311: http://bugs.python.org/issue1311

There (and always talking in windows), the OP says the in Py2.4
os.path.exists("nul") returned True and now in 2.5 returns False. Note
that "nul" is an special file, something like /dev/null.

We made some tests, and we have inconsisten behaviour in previous
Python versions. For example, in Py2.3.5 in my machine I get a False,
as in Py2.5. But other person in the bug, gets True in 2.3.3 and
False in 2.5.

Even the OP has differents result for the same Python 2.4 in different machines.

Right now (but don't know exactly since when), Python relies in
kernel32.dll functions to make the stat on the file (if stat raises an
error, os.path.exists says that the file does not exist). Of course,
if I call to this function separately, I have the same behaviour.

So, the question is what we should do?:

1. Rely on the kernel32 function and behaves like it says?

2. Return a fixed response for this special file "nul"?

Personally, I prefer the first one, but it changed the semantic of
os.path.exists("nul") (but this semantic is not clear, as we get
different behaviour in different Python versions and windows

Thank you very much!


.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/

More information about the Python-Dev mailing list