os.mkdir() errno inconsistency on Windows?
Thomas Jensen
thomasNO at SPAM.obscure.dk
Tue Dec 11 16:47:42 EST 2001
"Irmen de Jong" <usenet at NOSPAM-irmen.cjb.net> wrote in
news:9v5rmb$36u$1 at news1.xs4all.nl:
> 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:\\'
Well, it's consistent with the command shell's behaviour:
C:\>mkdir C:\test
C:\>mkdir C:\test
A subdirectory or file C:\test already exists.
C:\>mkdir C:\
Access is denied.
I guess Python just forwards the shell's behaviour? (OSError also
suggests that).
Doesn't help you with your problem, but it's not Python's "fault" :-)
--
Thomas Jensen
More information about the Python-list
mailing list