➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: Windows 8 x64 - IO-Error
类型: behavior Stage: resolved
Components: IO, Windows Versions: Python 2.7, Python 2.6
process
状态: closed Resolution: duplicate
Dependencies: 后续: test.support.unlink issue on Windows platform
View: 7443
分配给: 抄送列表: brian.curtin, cmikula, loewis, r.david.murray, tim.golden
优先级: normal 关键字:

Created on 2012-09-15 12:57 by cmikula, last changed 2022-04-11 14:57 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
dir_test.png cmikula, 2012-09-15 12:57 image with error message
Messages (5)
msg170514 - (view) Author: Christian Mikula (cmikula) 日期: 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) 日期: 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) 日期: 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) 日期: 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) 日期: 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.
历史
日期 用户 动作 参数
2022-04-11 14:57:36admin修改github: 60150
2012-09-19 09:32:23loewis修改抄送: + loewis
消息: + msg170717
2012-09-15 16:38:31brian.curtin修改状态: open -> closed
后续: test.support.unlink issue on Windows platform
消息: + msg170524

type: crash -> behavior
resolution: duplicate
stage: resolved
2012-09-15 13:26:05cmikula修改消息: + msg170517
2012-09-15 13:13:54r.david.murray修改抄送: + r.david.murray, tim.golden, brian.curtin
消息: + msg170515
2012-09-15 13:05:15cmikula修改type: crash
2012-09-15 12:57:39cmikula创建