|
Original |
Translation |
|
27
|
|
|
|
28
|
:pep:`338` -- Executing modules as scripts
|
|
|
29
|
Read commands from standard input (:data:`sys.stdin`). If standard input is a terminal, :option:`-i` is implied.
|
|
|
30
|
If this option is given, the first element of :data:`sys.argv` will be ``"-"`` and the current directory will be added to the start of :data:`sys.path`.
|
|
|
31
|
|
32
|
If this option is given, the first element of :data:`sys.argv` will be the script name as given on the command line.
|
|
|
33
|
If the script name refers directly to a Python file, the directory containing that file is added to the start of :data:`sys.path`, and the file is executed as the :mod:`__main__` module.
|
|
|
34
|
If the script name refers to a directory or zipfile, the script name is added to the start of :data:`sys.path` and the ``__main__.py`` file in that location is executed as the :mod:`__main__` module.
|
|
|
35
|
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 start of :data:`sys.path`.
|
|
|
36
|
|
|