Can anyone tell me why this behaviour is exhibited:
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
on said directory raises a WindowsError: "[Error 3] The system cannot find the path specified...."
I tried with a cmd console launched with "Run as administrator" context menu, too开发者_如何学Python. No dice:
If you're using a 32-bit Python build on 64-bit Windows, then accesses to C:\WINDOWS\SYSTEM32 will be transparently redirected to C:\WINDOWS\SYSWOW64. On 64-bit systems, SYSTEM32 contains 64-bit DLLs and SYSWOW64 contains 32-bit DLLs.
To access the real SYSTEM32 directory from a 32-bit Python, use C:\WINDOWS\SYSNATIVE.
http://msdn.microsoft.com/en-us/library/aa384187%28v=vs.85%29.aspx
精彩评论