Provide an environment variable for -E option

Hi There,

On the back of this issue, I’m wondering if simply adding an environment variable for the -E option for the python interpreter, in line with almost all the switches having environment variable support makes a lot of sense?

If you agree, I can raise this as a feature request on GitHub.

Many thanks.

It would be helpful if you say what the advantage would be.

1 Like

Hi Eric,
Thanks for getting back on this.

I see a couple of advantages:

  1. Having the ability to set -E in the env solves the issue of a script that’s been run with -E and then forks another script calling python without -E (the called script may not be owned by calller)

  2. -s -u -B already has env counterparts and this provides consistency


It’s somehow counterintuitive to set a PYTHON_IGNORE_ENV=1 environment variable to ask Python to ignore other environment variables :slight_smile: It makes sense, but it’s surprising.

Why not using the isolated mode, -I option, instead? What if it can be enabled by PYTHON_ISOLATED=1?