[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-03 Thread Steve Dower


Change by Steve Dower :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset 69af4395a25481e9de4009c816b6d1f032a2d8eb by Miss Islington (bot) 
in branch '3.7':
bpo-35692: pathlib no longer raises when checking file and directory existence 
on drives that are not ready (GH-11746)
https://github.com/python/cpython/commit/69af4395a25481e9de4009c816b6d1f032a2d8eb


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11686, 11687

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11686

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11686, 11687, 11688

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-03 Thread Steve Dower


Steve Dower  added the comment:


New changeset 2f6fae6e510dba653391cb510a2aca8322eec03b by Steve Dower in branch 
'master':
bpo-35692: pathlib no longer raises when checking file and directory existence 
on drives that are not ready (GH-11746)
https://github.com/python/cpython/commit/2f6fae6e510dba653391cb510a2aca8322eec03b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-02 Thread Steve Dower


Change by Steve Dower :


--
assignee:  -> steve.dower

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-02 Thread Steve Dower


Change by Steve Dower :


--
keywords: +patch, patch, patch
pull_requests: +11672, 11673, 11674
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-02 Thread Steve Dower


Change by Steve Dower :


--
keywords: +patch
pull_requests: +11672
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-02-02 Thread Steve Dower


Change by Steve Dower :


--
keywords: +patch, patch
pull_requests: +11672, 11673
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-01-15 Thread Eryk Sun


Eryk Sun  added the comment:

> There's no reason a non-existing drive should fail differently than 
> a non-existing parent directory.

The drive exists (or should) if we're getting ERROR_NOT_READY (21). It's likely 
a removable media device, such as an optical disc or card reader, and there's 
no media in the device. 

If a logical drive isn't defined at all, we should get ERROR_PATH_NOT_FOUND 
(from the NT status value STATUS_OBJECT_PATH_NOT_FOUND). This gets mapped to 
the errno value ENOENT, which is already handled. For example:

>>> os.stat('Q:/')
Traceback (most recent call last):
  File "", line 1, in 
FileNotFoundError: [WinError 3] The system cannot find the path specified: 
'Q:/'

>>> pathlib.Path('Q:/whatever/blah.txt').exists()
False

Similarly if a UNC 'drive' doesn't exist, we should get ERROR_BAD_NET_NAME 
(from NT STATUS_BAD_NETWORK_NAME), which is also mapped to ENOENT:

>>> os.stat('//some/where')
Traceback (most recent call last):
  File "", line 1, in 
FileNotFoundError: [WinError 67] The network name cannot be found: 
'//some/where'

>>> pathlib.Path('//some/where/whatever/blah.txt').exists()
False

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-01-15 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I think exists() should simply return False here.  There's no reason a 
non-existing drive should fail differently than a non-existing parent directory.

--
stage:  -> needs patch
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-01-15 Thread Steve Dower


Steve Dower  added the comment:

In issue 22759 there was some logic applied for which errors to forward rather 
than hide.

I'm inclined to agree that this one should be hidden, but it may have to be 
done by checking the winerror field rather than the exception type, since other 
PermissionErrors may mean the file is guaranteed to exist (but you can't touch 
it) or that the path exists up to the point where you are not allowed to see.

I'd happily argue that since these permissions indicate that the file does not 
exist *for the current user* and so they should be swallowed more broadly, but 
I'll let Antoine make the call.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-01-09 Thread Brett Cannon


Change by Brett Cannon :


--
components: +Library (Lib), Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-01-08 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-01-08 Thread Jordan Hueckstaedt


New submission from Jordan Hueckstaedt :

Tested in 3.7.0 on windows 10.
This looks related to https://bugs.python.org/issue22759


>>> import pathlib
>>> pathlib.Path(r"E:\Whatever\blah.txt").exists()  # This drive doesn't exist
Traceback (most recent call last):
  File "", line 1, in 
  File 
"C:\Users\jordanhu\AppData\Local\Continuum\anaconda2\envs\py3\lib\pathlib.py", 
line 1318, in exists
self.stat()
  File 
"C:\Users\jordanhu\AppData\Local\Continuum\anaconda2\envs\py3\lib\pathlib.py", 
line 1140, in stat
return self._accessor.stat(self)
PermissionError: [WinError 21] The device is not ready: 'E:\\Whatever\\blah.txt'
>>> pathlib.Path(r"C:\Whatever\blah.txt").exists() # This drive exists
False

--
messages: 333275
nosy: Jordan Hueckstaedt
priority: normal
severity: normal
status: open
title: pathlib.Path.exists() on non-existent drive raises WinError instead of 
returning False
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com