Message7864

Author jeff.allen
Recipients amak, dchrome, fwierzbicki, jeff.allen
Date 2013-02-28.08:29:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362040158.54.0.434137266612.issue2014@psf.upfronthosting.co.za>
In-reply-to
Content
I did a quick test on my Windows 7 x64 box and may have the explanation.

Jython 2.7b1+ (default:ebb67f175c9f+, Feb 17 2013, 23:49:57)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_35
Type "help", "copyright", "credits" or "license" for more information.
>>> import os

Done progressively, locally, it works:
>>> os.mkdir("junk")
>>> os.mkdir("junk\\1")
>>> os.mkdir("junk\\2")

I deleted the junk folder here in Windows Explorer. Done as a path all in one go, it fails, but with error 3 and a not very good message:

>>> os.mkdir("junk\\1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 3] No such process: 'C:\\Users\\Jeff\\Documents\\Eclipse\\jython-trunk\\junk\\1'

Then I tried again in the root (of C:):

>>> os.mkdir("\\junk\\1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 3] No such process: '\\junk\\1'

But done progressively it works:
>>> os.mkdir("\\junk")
>>> os.mkdir("\\junk\\1")

If I try to create it again (no intervening delete) I get the error we're looking for:
>>> os.mkdir("\\junk\\1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 20047] Unknown error: 20047: '\\junk\\1'

I get similar results with CPython 2.7:

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.mkdir("junk2\\1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 3] The system cannot find the path specified: 'junk2\\1'
>>> os.mkdir("junk2\\1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 3] The system cannot find the path specified: 'junk2\\1'
>>> os.mkdir("junk2")
>>> os.mkdir("junk2\\1")
>>> os.mkdir("\\junk2\\2")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 3] The system cannot find the path specified: '\\junk2\\2'
>>> os.mkdir("\\junk2")
>>> os.mkdir("\\junk2\\2")
>>> os.mkdir("\\junk2\\2")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 183] Cannot create a file when that file already exists: '\\junk2\\2'
>>>

Different number and a more helpful message, but it works and fails in the same places.

As it appears os.mkdir cannot and never could make paths, we should assume that in Paul's case, \temp exists beforehand and only ddir is being created. We know that file deletion on Windows often raises error 17 (no permission) when Python tries to to unlink a file à la Unix. (The theory is that something else is still using the file, maybe a virus checker: Windows is another country.)

Since Paul states that errors 0 and 17 are ignored, I speculate that in this case, a previous pass has failed to delete ddir, and the error (maybe 13) ignored. Perhaps the present unexpected error results from trying to create a directory that already exists?
History
Date User Action Args
2013-02-28 08:29:18jeff.allensetmessageid: <1362040158.54.0.434137266612.issue2014@psf.upfronthosting.co.za>
2013-02-28 08:29:18jeff.allensetrecipients: + jeff.allen, fwierzbicki, amak, dchrome
2013-02-28 08:29:18jeff.allenlinkissue2014 messages
2013-02-28 08:29:18jeff.allencreate