[issue40693] pathlib.Path will be broken with os.chdir command.

2020-05-19 Thread Eric V. Smith
Eric V. Smith added the comment: https://stackoverflow.com/questions/7116889/is-module-file-attribute-absolute-or-relative and https://bugs.python.org/issue18416 might help explain behavior. I agree it's working as designed. -- nosy: +eric.smith _

[issue40693] pathlib.Path will be broken with os.chdir command.

2020-05-19 Thread Zachary Ware
Zachary Ware added the comment: I don't see anything broken here: `__file__` is "scripts/test.py", `Path(__file__).parent` is "scripts", and `__file__` doesn't change just because the working directory changed (it's a static string set at import time, which is only a relative path because yo

[issue40693] pathlib.Path will be broken with os.chdir command.

2020-05-19 Thread SilentGhost
Change by SilentGhost : -- components: +Library (Lib) nosy: +pitrou stage: -> needs patch type: -> behavior versions: +Python 3.7 ___ Python tracker ___ _

[issue40693] pathlib.Path will be broken with os.chdir command.

2020-05-19 Thread Y Ono
Y Ono added the comment: It's the same as when executing `os.path.abspath`. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue40693] pathlib.Path will be broken with os.chdir command.

2020-05-19 Thread Y Ono
New submission from Y Ono : ``` import os from pathlib import Path os.chdir(Path(__file__).parent) print(Path(__file__).absolute()) ``` I put the code into a file in `/tmp/test.py`, and execute it from `/tmp/` directory like below. Then the output showed `/tmp/scripts/scripts/test.py`. ``` $