[Python-checkins] [3.7] bpo-33095: Add reference to isolated mode in -m and script option (GH-7764) (GH-16181)
Julien Palard
webhook-mailer at python.org
Mon Sep 16 08:30:36 EDT 2019
https://github.com/python/cpython/commit/210dc3bb37ec57a8b8b16ffe0881181138a6e973
commit: 210dc3bb37ec57a8b8b16ffe0881181138a6e973
branch: 3.7
author: Julien Palard <julien at palard.fr>
committer: GitHub <noreply at github.com>
date: 2019-09-16T14:30:33+02:00
summary:
[3.7] bpo-33095: Add reference to isolated mode in -m and script option (GH-7764) (GH-16181)
Attempt to make isolated mode easier to discover via additional inline documentation.
Co-Authored-By: Julien Palard <julien at palard.fr>.
(cherry picked from commit bdd6945d4dbd1fe6a7fcff95f7d6908db7d791a1)
Co-authored-by: Xtreak <tir.karthi at gmail.com>
files:
M Doc/using/cmdline.rst
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index dca89eceeda9..6a60bc4954c6 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -100,6 +100,11 @@ source.
first element will be set to ``"-m"``). As with the :option:`-c` option,
the current directory will be added to the start of :data:`sys.path`.
+ :option:`-I` option can be used to run the script in isolated mode where
+ :data:`sys.path` contains neither the current directory nor the user's
+ site-packages directory. All :envvar:`PYTHON*` environment variables are
+ ignored, too.
+
Many standard library modules contain code that is invoked on their execution
as a script. An example is the :mod:`timeit` module::
@@ -119,6 +124,7 @@ source.
.. versionchanged:: 3.4
namespace packages are also supported
+.. _cmdarg-dash:
.. describe:: -
@@ -130,6 +136,8 @@ source.
:data:`sys.path`.
+.. _cmdarg-script:
+
.. describe:: <script>
Execute the Python code contained in *script*, which must be a filesystem
@@ -148,6 +156,11 @@ source.
added to the start of :data:`sys.path` and the ``__main__.py`` file in
that location is executed as the :mod:`__main__` module.
+ :option:`-I` option can be used to run the script in isolated mode where
+ :data:`sys.path` contains neither the script's directory nor the user's
+ site-packages directory. All :envvar:`PYTHON*` environment variables are
+ ignored, too.
+
.. seealso::
:func:`runpy.run_path`
Equivalent functionality directly available to Python code
More information about the Python-checkins
mailing list