os.mkdir() errno inconsistency on Windows?
Irmen de Jong
usenet at NOSPAM-irmen.cjb.net
Tue Dec 11 15:52:27 EST 2001
Hi;
On windows (2000), Python 2.1:
Why does os.mkdir() return a different errno when trying to create an
already-existing directory, or trying to create the drive root directory?
See below:
>>> os.mkdir('d:\\test')
>>> os.mkdir('d:\\test')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OSError: [Errno 17] File exists: 'd:\\test'
>>> os.mkdir('d:\\')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OSError: [Errno 13] Permission denied: 'd:\\'
>>>
Thanks,
Irmen de Jong.
PS Why bother? Because I need to distinguish on exact Errno type, not only
on the OSError that's raised.
More information about the Python-list
mailing list