【发布时间】:2011-08-12 00:30:24
【问题描述】:
谁能告诉我为什么会出现这种行为:
C:\...>dir C:\Windows\System32\drivers\subdir\0xDEADBEEF.008
Volume in drive C is Win7HPx64
Volume Serial Number is 04BF-EE2E
Directory of C:\Windows\System32\drivers\subdir\0xDEADBEEF.008
08/11/2011 04:21 PM <DIR> .
08/11/2011 04:21 PM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 11,581,788,160 bytes free
C:\...>C:\Python27\python.exe
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> silo = r'C:\Windows\System32\drivers\subdir\0xDEADBEEF.008'
>>> os.path.isdir(silo)
False
>>> os.path.exists(silo)
False
上述目录上的os.stat引发WindowsError:“[错误3]系统找不到指定的路径....”
我也尝试使用“以管理员身份运行”上下文菜单启动的 cmd 控制台。没有骰子:
【问题讨论】:
-
你确定它还存在吗?
-
是的。我复制粘贴了所有内容(不仅是上面的屏幕,还包括资源管理器地址栏中的路径名)。
-
如果 Python 没有以管理员身份运行,它是否能够查看 `C:\Windows\System32`?
-
我也尝试过使用“以管理员身份运行”上下文菜单启动的 cmd 控制台。没有骰子。 :-(
-
我无法在 Windows 7、Python 2.7 和以管理员身份运行时重现此问题。在没有管理员提示的情况下没有尝试过,因为我必须先重新启用 UAC。