[New-bugs-announce] [issue38931] pathlib.Path on Windows - parser issue

tempest report at bugs.python.org
Wed Nov 27 12:16:00 EST 2019


New submission from tempest <online_m at majck.com>:

the Path parser from pathlib seems to give incorrect paths if a folder (subdirectory) name includes a period. (This issue does not manifest with Unix paths.) 

Please see a demonstration below: "Out[2]" is not the same as "Out[3]" and "Out[4]"; the "\" separator following the folder name with the period is not converted to the forward slash ("/") in the WindowsPath() when the full path is given as a Windows path string. This issue manifests with pathlib.WindowsPath() as well. This is Python 3.7.4 from the Anaconda distribution.

Jupyter QtConsole 4.6.0
Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pathlib import Path

In [2]: Path('C:\Temp\MyProj.wc\test.eps')
Out[2]: WindowsPath('C:/Temp/MyProj.wc\test.eps')

In [3]: Path('C:\Temp\MyProj.wc').joinpath('test.eps')
Out[3]: WindowsPath('C:/Temp/MyProj.wc/test.eps')

In [4]: Path('C:/Temp/MyProj.wc/test.eps')
Out[4]: WindowsPath('C:/Temp/MyProj.wc/test.eps')

----------
components: Windows
messages: 357574
nosy: paul.moore, steve.dower, tempest, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pathlib.Path on Windows - parser issue
type: behavior
versions: Python 3.7

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


More information about the New-bugs-announce mailing list