3 ms·
No, that's unrelated to PYTHONPATH; it wouldn't break either.
by jwilk 6y ago
No, that's unrelated to PYTHONPATH; it wouldn't break either.
- masklinn 6y agoIt's not. That sys.path includes "." when running a script lets you import files next to the script. This is trivial to confirm: > cat "import bar" > foo.py > touch bar.py > python foo.py > python -I foo.py Traceback (most recent call last): File "foo.py", line 1, in <module> import bar ModuleNotFoundError: No module named 'bar' and this is exactly the feature which makes it risky to run `python` from an untrusted location.
- jwilk 6y agoBut there's no PYTHONPATH involved here. If you changed semantics of PYTONPATH as dwheeler suggested, everything would continue to work as you shown.