+1

On Thu, Feb 20, 2020 at 11:46 Alex Hall <alex.mojaki@gmail.com> wrote:
Christopher Barker wrote:
> I think it’s a “Bad Idea” to use an environment variable — who knows what
> Python script may be running on a given system?
> But a standard command line argument to the interpreter could be useful.

Can you clarify what the concern is about other Python scripts running? Why doesn't that apply to [all the other special PYTHON* environment variables](https://docs.python.org/3/using/cmdline.html#environment-variables), such as `PYTHONWARNINGS` or `PYTHONVERBOSE`?

Command line arguments only work if you're invoking the `python` command directly. If you're running something above that like a bash script or a package entrypoint it's more complicated. And configuring environment variables is sometimes easier than changing a command or editing a script, like when you're configuring a service hosted in the cloud (personally I'm thinking of AWS ECS).

I say do the same thing as so many other options and offer both a command line argument and an environment variable. I don't think many people will be setting the environment variable in their global shell profiles. When I want to set PYTHONPATH I usually write:

    PYTHONPATH=/some/path python script.py

which has no chance to affect anything else.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/LXLSYULFPYNAVPFC3E66LLJQF2SCOER7/
Code of Conduct: http://python.org/psf/codeofconduct/
--
--Guido (mobile)