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
Title: File access not always working with Python for Windows 32 bits on Windows 64 bits OS
Type: behavior Stage:
Components: Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Antoine.Brodin, tim.golden
Priority: normal Keywords:

Created on 2012-11-21 16:18 by Antoine.Brodin, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg176064 - (view) Author: Antoine Brodin (Antoine.Brodin) Date: 2012-11-21 16:18
I have a file:

>dir c:\Windows\System32\scext.dll
14/07/2009  02:41            89 088 scext.dll

With Python 32 bits it fails:

>c:\Python27\python.exe
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat('c:\Windows\System32\scext.dll')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 2] Le fichier spÚcifiÚ est introuvable: 'c:\\Windows\\Syste
m32\\scext.dll'

With Python 64bits it succeeds:

>c:\Python27-x64\python.exe
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat('c:\Windows\System32\scext.dll')
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=89088L, st_atime=1247527874L, st_mtime=1247535713L, st_ctime=1247527874L)
msg176065 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2012-11-21 16:20
Not Python, but Windows. See here:

  http://msdn.microsoft.com/en-gb/library/windows/desktop/aa384187%28v=vs.85%29.aspx
msg176066 - (view) Author: Antoine Brodin (Antoine.Brodin) Date: 2012-11-21 16:39
Ok,  with Python 32 bits I can do:
>>> os.stat('c:\windows\sysnative\scext.dll')
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=89088L, st_atime=1247527874L, st_mtime=1247535713L, st_ctime=12475278
74L)

I will try to use this workaround in my scripts.
History
Date User Action Args
2022-04-11 14:57:38adminsetgithub: 60728
2012-11-23 20:19:02terry.reedysetstatus: open -> closed
resolution: not a bug
2012-11-21 16:39:44Antoine.Brodinsetmessages: + msg176066
2012-11-21 16:20:51tim.goldensetnosy: + tim.golden
messages: + msg176065
2012-11-21 16:18:02Antoine.Brodincreate