[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 
<https://bugs.python.org/issue40693>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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`.

```
$ python scripts/test.py
/tmp/scripts/scripts/test.py
```


After executing `os.chdir`, pathlib's path handling is completely broken.

--
components: C API
messages: 369410
nosy: Y Ono
priority: normal
severity: normal
status: open
title: pathlib.Path will be broken with os.chdir command.
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue40693>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com