[issue41448] pathlib behave differ between OS

2020-07-31 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist ___ Python tracker

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan
Mond Wan added the comment: Thanks for the clarifications on PurePosixPath(). Now, I know which library I should use to solve my problem. For resolve() with strict True, I have tried on both platform. They will both raise exception if that file does not exists. --

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Ronald Oussoren
Ronald Oussoren added the comment: PureWindowsPath does not know about POSIX paths, it supports the two styles of directory separator that are valid on Windows: '/' and '\'. PurePosixPath only supports the single stile of directory separator valid on POSIX systems: '/'. On a Posix system

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan
Mond Wan 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) >>>

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan
Mond Wan added the comment: Let me clarify my expectation. # For `as_posix()` * PureWindowsPath can translate both POSIX path, and WINDOW path to POSIX path via `as_posix()` * Therefore, I expect PurePosixPath can translate both platform path to POSIX path via `as_posix()` * I just

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Ronald Oussoren
Ronald Oussoren added the comment: I'm not sure what you try to report. PurePath(...) returns a PureWindowsPath on Windows and an PurePosixPath on other (unix-y) platforms. This explains the difference in behaviour you're seeing for as_posix(). --

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan
Change by Mond Wan : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Mond Wan
New submission from Mond Wan : I have tried 2 functions with different behavior across platform # as_posix() In linux platform, as_posix() cannot process window path nicely * From linux + docker + python:3.8 ``` Python 3.8.0 (default, Oct 17 2019, 05:36:36) [GCC 8.3.0] on linux >>> winPath