On Mon, Feb 24, 2020 at 11:51 AM Brianvanderburg2 via Python-ideas <
python-ideas@python.org> wrote:

> When running a python script directly, the directory of that script gets
> added to sys.path.  When running as a module "python -m", it looks like an
> empty string gets added to sys.path, which appears to result in CWD being
> used.
>

Are you familiar with the -I option for "isolated mode"?
https://docs.python.org/3/using/cmdline.html#id2

-I
Run Python in isolated mode. This also implies -E and -s. In isolated mode
sys.path contains neither the script’s directory nor the user’s
site-packages directory. All PYTHON* environment variables are ignored,
too. Further restrictions may be imposed to prevent the user from injecting
malicious code. New in version 3.4.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NXGL4FT37MZ6QEPYQBJVI6Y2K4O2WMWF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to