[Python-Dev] Special file "nul" in Windows and os.stat
Scott Dial
scott+python-dev at scottdial.com
Thu Oct 25 00:07:46 CEST 2007
Fred Drake wrote:
> It's special, but in a different way. /dev/null really exists in the
> Unix filesystem; "nul" is more magical than that.
>
> What's more, it has peers: "prn", "com1" and others like that.
>
For the record, the fixed names 'aux', 'con', 'nul', and 'prn' along
with the set of 'com[0-9]' and 'lpt[0-9]' names that are reserved. And
for that matter, any of those with an extension is reserved as well.
These files always exist as far as I am concerned (where existence is
defined by your ability to open() them).
def is_special_on_win32(name):
import os.path, re
name = os.path.basename(name)
return (re.match('(nul|prn|aux|con|com[0-9]|lpt[0-9])(\..*)?$',
name) is not None)
--
Scott Dial
scott at scottdial.com
scodial at cs.indiana.edu
More information about the Python-Dev
mailing list