arguments. It is recommended that the :mod:`sys` module be left alone when
invoking this function from threaded code.
+ .. seealso::
+ The :option:`-m` option offering equivalent functionality from the
+ command line.
.. versionchanged:: 3.1
Added ability to execute packages by looking for a ``__main__`` submodule.
limitations still apply, use of this function in threaded code should be
either serialised with the import lock or delegated to a separate process.
+ .. seealso::
+ :ref:`using-on-interface-options` for equivalent functionality on the
+ command line (``python path/to/script``).
+
.. versionadded:: 3.2
.. versionchanged:: 3.4
.. seealso::
- :pep:`338` - Executing modules as scripts
+ :pep:`338` -- Executing modules as scripts
PEP written and implemented by Nick Coghlan.
- :pep:`366` - Main module explicit relative imports
+ :pep:`366` -- Main module explicit relative imports
PEP written and implemented by Nick Coghlan.
- :pep:`451` - A ModuleSpec Type for the Import System
+ :pep:`451` -- A ModuleSpec Type for the Import System
PEP written and implemented by Eric Snow
:ref:`using-on-general` - CPython command line details
-.. highlightlang:: none
+.. highlightlang:: sh
.. ATTENTION: You probably should update Misc/python.man, too, if you modify
-.. this file.
+ this file.
.. _using-on-general:
added to the start of :data:`sys.path` and the ``__main__.py`` file in
that location is executed as the :mod:`__main__` module.
+ .. seealso::
+ :func:`runpy.run_path`
+ Equivalent functionality directly available to Python code
+
If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is
an empty string (``""``) and the current directory will be added to the
automatically enabled, if available on your platform (see
:ref:`rlcompleter-config`).
+.. seealso:: :ref:`tut-invoking`
+
.. versionchanged:: 3.4
Automatic enabling of tab-completion and history editing.
-.. seealso:: :ref:`tut-invoking`
-
Generic options
~~~~~~~~~~~~~~~