[issue41448] pathlib behave differ between OS

Mond Wan report at bugs.python.org
Fri Jul 31 07:27:58 EDT 2020


Mond Wan <victor2wen at gmail.com> added the comment:

Moreover, output from PurePosixPath.as_posix() is not that straightforward?

Please take a look below example from python3.6 + linux + docker

```
>>> winPath = r'\workspace\xxx\test_fixture\user-restore-success.zip'

>>> pWIN = pathlib.PureWindowsPath(winPath)
>>> pppFromWinPath = pathlib.PurePosixPath(winPath)
>>> pppFromPwp = pathlib.PurePosixPath(pWIN)

>>> pppFromWinPath.as_posix()
'\\workspace\\xxx\\test_fixture\\user-restore-success.zip'
>>> pppFromPwp.as_posix()
'\\/workspace/xxx/test_fixture/user-restore-success.zip'
```

* Construction PurePosixPath from rawString, `as_posix()` gives '\\workspace\\xxx\\test_fixture\\user-restore-success.zip'
* Construction PurePosixPath from PureWindowsPath, `as_posix()` gives '\\/workspace/xxx/test_fixture/user-restore-success.zip'

----------

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


More information about the Python-bugs-list mailing list