gpt4 book ai didi

python - os.path.exists 无法识别 C :\Windows\system32\drivers 下的子目录

转载 作者:可可西里 更新时间:2023-11-01 11:21:45 25 4
gpt4 key购买 nike

谁能告诉我为什么会出现这种行为:

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 控制台。没有骰子:

running as administrator

最佳答案

如果您在 64 位 Windows 上使用 32 位 Python 构建,那么对 C:\WINDOWS\SYSTEM32 的访问将被透明地重定向到 C:\WINDOWS\SYSWOW64。在 64 位系统上,SYSTEM32 包含 64 位 DLL,SYSWOW64 包含 32 位 DLL。

要从 32 位 Python 访问真正的 SYSTEM32 目录,请使用 C:\WINDOWS\SYSNATIVE。

http://msdn.microsoft.com/en-us/library/aa384187%28v=vs.85%29.aspx

关于python - os.path.exists 无法识别 C :\Windows\system32\drivers 下的子目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7034475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com