New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os.stat fails on mapped network drive #54388
Comments
This network drive is actually mapped through the VirtualBox guest additions. Under Python 2.7 (official 64-bit MSI installer), this works fine: >>> s = 'Z:\\__svn__\\Lib\\test\\keycert.pem'
>>> os.stat(s)
nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=1783L, st_atime=1287771307L, st_mtime=1286578916L, st_ctime=1286578916L) Under a freshly compiled 32-bit py3k, though, it fails with a rather strange error message: >>> s = 'Z:\\__svn__\\Lib\\test\\keycert.pem'
>>> os.stat(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error 1] Incorrect function: 'Z:\\__svn__\\Lib\\test\\keycert.pem'
>>> errno.errorcode[1]
'EPERM' While a local directory works fine: >>> os.stat('c:\\Windows')
nt.stat_result(st_mode=16895, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=16384, st_atime=1287843075, st_mtime=1287843075, st_ctime=1247541608) |
And 3.1 works fine. |
Hmm, it looks like this is actually VirtualBox-specific. >>> os.stat(r"y:")
nt.stat_result(st_mode=16895, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0, st_atime=1287784175, st_mtime=1281439296, st_ctime=1281439296)
>>> os.stat(r"z:")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error 1] Incorrect function: 'z:' |
Let me guess: It's GetFinalPathNameByHandle that is failing. Put some debug output right after the call to verify. Why is this critical? Not being able to stat VirtualBox folders doesn't sound that critical to me. |
Yes, indeed. It was critical before I found out that it's VirtualBox-specific. |
This patch seems to do the trick, although I'm not sure it warrants including in Python. |
I think something like this is worth adding. I'd like to see two changes implemented:
|
Can you try my patch in bpo-10027? Does this also fail? |
No, your patch seems to fix the issue. |
Just housekeeping some Windows calls: Antoine, your last comment suggests that this is no longer an issue. I don't have a VirtualBox install to test, so can you confirm whether this can be closed? |
I don't know, I have stopped using VirtualBox here. Suggest closing. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: