You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Directory containing file unconditionally appended to sys.path #271
All files are empty except foo/script.py, which simply contains import bar.thing.
The directory containing foo is added to the PYTHONPATH environment variable globally.
$ env PYTHONPATH=. python foo/script.py
Traceback (most recent call last):
File "/foo/script.py", line 1, in<module>
import bar.thing
ModuleNotFoundError: No module named 'bar.thing';'bar' is not a package
This is expected, since foo/bar.py shadows bar/thing.py due to python adding the directory of the invoked file to sys.path.
If you configure pycharm to run your script with PYTHONSAFEPATH=1 pydevd.py will still unconditionally prepend the scripts directory and you will get the import failure when debugging.
Activity