Message323800
With "." in sys.path the "__file__" attribute will be a relative path, and therefore cannot be used after "chdir".
This likely affects relative paths in general, but have not tested it.
```
import os
import sys
sys.path.insert(0, '.')
# Importing it before chdir already causes failure.
import imported
os.chdir('/')
print(imported.__file__) # ./imported.py
assert imported.__file__ == os.path.abspath(imported.__file__)
```
It works for "" in sys.path (https://bugs.python.org/issue18416). |
|
Date |
User |
Action |
Args |
2018-08-20 16:57:16 | blueyed | set | recipients:
+ blueyed |
2018-08-20 16:57:16 | blueyed | set | messageid: <1534784236.56.0.56676864532.issue34444@psf.upfronthosting.co.za> |
2018-08-20 16:57:16 | blueyed | link | issue34444 messages |
2018-08-20 16:57:16 | blueyed | create | |
|