Issue20541
Created on 2014-02-07 12:47 by ncoghlan, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg210460 - (view) | Author: Alyssa Coghlan (ncoghlan) * ![]() |
Date: 2014-02-07 12:47 | |
In trying to figure out why my fix for issue 20053 wasn't working on Windows, I eventually traced it back to the fact that "os.path.exists(os.devnull)" returns False on Windows, so pip isn't picking up my config file override in ensurepip, and reads the global default config file anyway. However, if you do "if exist NUL (echo exists) ELSE (echo missing)" in cmd, it will print "exists", so this looks like a bug in our os.path.exists implementation. That is currently implemented in genericpath and assumes that a file exists if-and-only-if os.stat(name) doesn't throw an exception. It turns out this assumption isn't really correct on Windows - 'NUL' and 'CON' (and presumably other special files) can be opened, but trying to do os.stat() on them throws an exception. |
|||
| msg210461 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2014-02-07 13:01 | |
See also: http://bugs.python.org/issue1311 |
|||
| msg210475 - (view) | Author: Alyssa Coghlan (ncoghlan) * ![]() |
Date: 2014-02-07 14:37 | |
As per issue 1311, the exists returns True <-> stat will work equivalence is deliberate. We'll have to find a different way to resolve issue 20053 on Windows. Due to the special files on Windows, the only reliable cross-platform way to find out whether or not *open* will work on a given filename is to actually try it. |
|||
| msg210500 - (view) | Author: Eric Snow (eric.snow) * ![]() |
Date: 2014-02-07 17:28 | |
> As per issue 1311, the exists returns True <-> stat will work equivalence is deliberate. We'll have to find a different way to resolve issue 20053 on Windows. I was going t say we should note this design/impl. detail in the os.path.exists() docs. However, it already is! :) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:58 | admin | set | github: 64740 |
| 2014-02-07 17:28:55 | eric.snow | set | nosy:
+ eric.snow messages: + msg210500 |
| 2014-02-07 14:37:58 | ncoghlan | set | status: open -> closed resolution: not a bug messages: + msg210475 stage: test needed -> resolved |
| 2014-02-07 13:06:56 | ncoghlan | link | issue20053 dependencies |
| 2014-02-07 13:01:39 | vajrasky | set | nosy:
+ vajrasky messages: + msg210461 |
| 2014-02-07 12:47:34 | ncoghlan | create | |
