[New-bugs-announce] [issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

gaborjbernat report at bugs.python.org
Thu Jan 7 04:23:21 EST 2021


New submission from gaborjbernat <gaborjbernat at gmail.com>:

❯ py -c "from pathlib import Path; Path('http://w.org').exists()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python39\lib\pathlib.py", line 1407, in exists
    self.stat()
  File "C:\Python39\lib\pathlib.py", line 1221, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'http:\\w.org'

The above code returns correctly False on UNIX systems.

----------
components: Windows
messages: 384569
nosy: gaborjbernat, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pathlib.exists on Windows raises an exception on URL like/bad input
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42855>
_______________________________________


More information about the New-bugs-announce mailing list