New submission from John Jefferies: If os.stat is executed on a Windows junction with Python 3.3 I see an exception: ------------ >>> import os >>> os.stat('C:\Windows\System32\config\systemprofile\SendTo') Traceback (most recent call last): File "<stdin>", line 1, in <module> FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Windows\\System32\\config\\systemprofile\\SendTo' ------------
whereas with Python 3.2 it works without error: ------------ >>> import os >>> os.stat('C:\Windows\System32\config\systemprofile\SendTo') nt.stat_result(st_mode=16895, st_ino=281474977136630, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1295885671, st_mtime=1295885671, st_ctime=1295885671) ------------ FTR. Some background: It's a pity that Python doesn't just treat Windows junctions as a normal soft link. But given that islink() returns False for a junction, I was able to work around that in Python 3.2 like this: ------------ if os.path.islink(fullname) or \ os.stat(fullname)[stat.ST_INO] != os.lstat(fullname)[stat.ST_INO]: # If it's not a link, it's probably a junction... ------------ Many thanks for looking. John ---------- components: Library (Lib) messages: 191899 nosy: John.Jefferies priority: normal severity: normal status: open title: os.stat gives exception for Windows junctions in v3.3 type: behavior versions: Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18306> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com