classification
Title: Windows 8 x64 - IO-Error
Type: behavior Stage: resolved
Components: IO, Windows Versions: Python 2.7, Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: test.support.unlink issue on Windows platform
View: 7443
Assigned To: Nosy List: brian.curtin, cmikula, loewis, r.david.murray, tim.golden
Priority: normal Keywords:

Created on 2012-09-15 12:57 by cmikula, last changed 2012-09-19 09:32 by loewis. This issue is now closed.

Files
File name Uploaded Description Edit
dir_test.png cmikula, 2012-09-15 12:57 image with error message
Messages (5)
msg170514 - (view) Author: Christian Mikula (cmikula) Date: 2012-09-15 12:57
OS Windows 8 Enterprise x64 clean installed.
Python Version 2.6.6 and 2.7.3 both x64 installed.

Problem is to delete one Directory and immediately after create one new with the same Name!

!!! Code !!!

import sys, platform, os, shutil

TEST_PATH = "/test"

print "platform:\t", platform.platform()
print "sys.platform:\t", sys.platform
print "sys.version:\t", sys.version
print "directory test:\t'%s'" % TEST_PATH
print

if os.path.exists(TEST_PATH):
    shutil.rmtree(TEST_PATH)
if not os.path.exists(TEST_PATH):
    os.makedirs(TEST_PATH)

print "success"

!!! End of code !!!

The error is only present if the Directory was deleted previously.

Error:
Traceback (most recent call last):
  File "dir_test.py", line 23, in <module>
    os.makedirs(BUILD_PATH)
  File "C:\Program Files\Python27\lib\os.py", line 157, in makedirs
    mkdir(name, mode)
WindowsError: [Error 5] Zugriff verweigert: '/test'
msg170515 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-09-15 13:13
I believe this is a Windows...feature?  We have lots of trouble with this ourselves in the test suite, if I understand correctly.
msg170517 - (view) Author: Christian Mikula (cmikula) Date: 2012-09-15 13:26
I also think that it is a windows feature! who should report this problem with microsoft?
msg170524 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-09-15 16:38
I'm not sure Microsoft is going to change anything about this - it has done this for a long time, if not forever. We recently had #15496 receive changes, and #7443 is in the same area and has more details and some patches, so I'd suggest taking up the discussion over there.
msg170717 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-09-19 09:32
I think it should be possible to add a wait=False parameter to rmtree which makes it block until the directory is gone away. This could be similar to the test.support feature added in #15496.

For compatibility, such a flag should default to False, and users need to be aware that this may block "indefinitely". I'd be opposed to specifying a timeout - users who need that can use the non-blocking version, and then loop themselves (or we expose a separate wait function with a timeout).

Of course, such a feature could not be added to 2.7.
History
Date User Action Args
2012-09-19 09:32:23loewissetnosy: + loewis
messages: + msg170717
2012-09-15 16:38:31brian.curtinsetstatus: open -> closed
superseder: test.support.unlink issue on Windows platform
messages: + msg170524

type: crash -> behavior
resolution: duplicate
stage: resolved
2012-09-15 13:26:05cmikulasetmessages: + msg170517
2012-09-15 13:13:54r.david.murraysetnosy: + r.david.murray, tim.golden, brian.curtin
messages: + msg170515
2012-09-15 13:05:15cmikulasettype: crash
2012-09-15 12:57:39cmikulacreate