Skip to content

Commit bdd6945

Browse files
tirkarthiJulienPalard
authored andcommitted
bpo-33095: Add reference to isolated mode in -m and script option (GH-7764)
Attempt to make isolated mode easier to discover via additional inline documentation. Co-Authored-By: Julien Palard <[email protected]>
1 parent bf16991 commit bdd6945

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Doc/using/cmdline.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ source.
101101
first element will be set to ``"-m"``). As with the :option:`-c` option,
102102
the current directory will be added to the start of :data:`sys.path`.
103103

104+
:option:`-I` option can be used to run the script in isolated mode where
105+
:data:`sys.path` contains neither the current directory nor the user's
106+
site-packages directory. All :envvar:`PYTHON*` environment variables are
107+
ignored, too.
108+
104109
Many standard library modules contain code that is invoked on their execution
105110
as a script. An example is the :mod:`timeit` module::
106111

@@ -121,6 +126,7 @@ source.
121126
.. versionchanged:: 3.4
122127
namespace packages are also supported
123128

129+
.. _cmdarg-dash:
124130

125131
.. describe:: -
126132

@@ -133,6 +139,8 @@ source.
133139

134140
.. audit-event:: cpython.run_stdin "" ""
135141

142+
.. _cmdarg-script:
143+
136144
.. describe:: <script>
137145

138146
Execute the Python code contained in *script*, which must be a filesystem
@@ -151,6 +159,11 @@ source.
151159
added to the start of :data:`sys.path` and the ``__main__.py`` file in
152160
that location is executed as the :mod:`__main__` module.
153161

162+
:option:`-I` option can be used to run the script in isolated mode where
163+
:data:`sys.path` contains neither the script's directory nor the user's
164+
site-packages directory. All :envvar:`PYTHON*` environment variables are
165+
ignored, too.
166+
154167
.. audit-event:: cpython.run_file filename
155168

156169
.. seealso::

0 commit comments

Comments
 (0)