[Python-ideas] CLI option for isolated mode

R. Michael Weylandt michael.weylandt at gmail.com
Thu Nov 8 23:35:02 CET 2012


On Thu, Nov 8, 2012 at 10:13 PM, Christian Heimes <christian at python.org> wrote:
> Hi everybody,
>
> I like to propose a new option for the Python interpreter:
>
>   python -I
>
> It shall start the interpreter in isolated mode which ignores any
> environment variables set by the user and any files installed by the
> user. The mode segregate a Python program from anything an unpriviliged
> user is able to modify and uses only files that are installed by a
> system adminstrator.
>
> The isolated mode implies -E (ignore all PYTHON* environment vars) and
> -s (don't add user site directory). It also refrains from the inclusion
> of '' or getcwd() to sys.path. TKinter doesn't load and execute Python
> scripts from the user's home directory. Other parts of the stdlib should
> be checked, too.
>
> The option is intended for OS and application scripts that doesn't want
> to become affected by user installed files or files in the current
> working path of a user.
>

R allows something quite similar with the "--vanilla" option. I can
attest that it's also quite helpful for debugging, particularly for
working around corrupted startup settings.

I do think I slightly prefer "vanilla" to possible I/l ["i" or "L"]
confusion, but I do appreciate that long flags are not the norm for
Python.

Michael



More information about the Python-ideas mailing list