chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
d6be1499-1740-5f29-a713-f945c476705c | docs | python | python_cmdline | 310 | 31 | for stdin/stdout/stderr, in the syntax `encodingname:errorhandler`. Both
the `encodingname` and the `:errorhandler` parts are optional and have
the same meaning as in [`str.encode()`](../library/stdtypes.html#str.encode "str.encode").
For stderr, the `:errorhandler` part is ignored; the handler will al... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
7837acc7-c6b5-5a57-940a-4959f8989e3f | docs | python | python_cmdline | 310 | 32 | [**PEP 370**](https://www.python.org/dev/peps/pep-0370) – Per user site-packages directory
`PYTHONUSERBASE`[¶](#envvar-PYTHONUSERBASE "Permalink to this definition")
: Defines the [`user base directory`](../library/site.html#site.USER_BASE "site.USER_BASE"), which is used to
compute the path of the [`user si... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
f5167020-dbbf-5613-88c8-cba26e7ef273 | docs | python | python_cmdline | 310 | 33 | separated string, it is equivalent to specifying [`-W`](#cmdoption-W) multiple
times, with filters later in the list taking precedence over those earlier
in the list.
The simplest settings apply a particular action unconditionally to all
warnings emitted by a process (even those that are otherwise ... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
393db367-2830-5021-9056-628d5e9f0293 | docs | python | python_cmdline | 310 | 34 | [`faulthandler.enable()`](../library/faulthandler.html#faulthandler.enable "faulthandler.enable") is called at startup: install a handler for
`SIGSEGV`, `SIGFPE`, `SIGABRT`, `SIGBUS` and
`SIGILL` signals to dump the Python traceback. This is equivalent to
[`-X`](#cmdoption-X) `faulthandler` option.
... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
5297aeea-248c-5470-9f95-a817adf72c8a | docs | python | python_cmdline | 310 | 35 | `PYTHONPROFILEIMPORTTIME`[¶](#envvar-PYTHONPROFILEIMPORTTIME "Permalink to this definition")
: If this environment variable is set to a non-empty string, Python will
show how long each import takes. This is exactly equivalent to setting
`-X importtime` on the command line.
New in version 3.7.
`PYTHONASY... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
931f4091-0f6b-5eef-81da-0a212643a1fa | docs | python | python_cmdline | 310 | 36 | for all domains (`PYMEM_DOMAIN_RAW`, `PYMEM_DOMAIN_MEM`,
`PYMEM_DOMAIN_OBJ`).
* `pymalloc`: use the [pymalloc allocator](../c-api/memory.html#pymalloc) for
`PYMEM_DOMAIN_MEM` and `PYMEM_DOMAIN_OBJ` domains and use
the `malloc()` function for the `PYMEM_DOMAIN_RAW` domain.
Install [debug... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
18747619-20ea-5c25-a934-5d60ce8cda9b | docs | python | python_cmdline | 310 | 37 | This variable is ignored if the [`PYTHONMALLOC`](#envvar-PYTHONMALLOC) environment variable
is used to force the `malloc()` allocator of the C library, or if
Python is configured without `pymalloc` support.
Changed in version 3.6: This variable can now also be used on Python compiled in release mode.
... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
ce3c16c9-f2d6-509e-9e6d-607220f04f79 | docs | python | python_cmdline | 310 | 38 | [Availability](../library/intro.html#availability): Windows.
New in version 3.6: See [**PEP 529**](https://www.python.org/dev/peps/pep-0529) for more details.
`PYTHONLEGACYWINDOWSSTDIO`[¶](#envvar-PYTHONLEGACYWINDOWSSTDIO "Permalink to this definition")
: If set to a non-empty string, does not use the new c... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
46742c20-21f0-5adc-ab1e-53749df8c54f | docs | python | python_cmdline | 310 | 39 | If this variable is *not* set (or is set to a value other than `0`), the
`LC_ALL` locale override environment variable is also not set, and the
current locale reported for the `LC_CTYPE` category is either the default
`C` locale, or else the explicitly ASCII-based `POSIX` locale, then the
Python CLI... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
02fff990-24b3-513d-93d0-e6021a853896 | docs | python | python_cmdline | 310 | 40 | whether or not those processes are running a Python interpreter), as well as
in operations that query the environment rather than the current C locale
(such as Python’s own [`locale.getdefaultlocale()`](../library/locale.html#locale.getdefaultlocale "locale.getdefaultlocale")).
Configuring one of these... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
97b3cf17-61ae-5c79-b09b-d7aeff437ce6 | docs | python | python_cmdline | 310 | 41 | Python to emit warning messages on `stderr` if either the locale coercion
activates, or else if a locale that *would* have triggered coercion is
still active when the Python runtime is initialized.
Also note that even when locale coercion is disabled, or when it fails to
find a suitable target loca... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
846c055e-3609-553d-8847-19d40ec64841 | docs | python | python_cmdline | 310 | 42 | New in version 3.7.
`PYTHONUTF8`[¶](#envvar-PYTHONUTF8 "Permalink to this definition")
: If set to `1`, enable the [Python UTF-8 Mode](../library/os.html#utf8-mode).
If set to `0`, disable the [Python UTF-8 Mode](../library/os.html#utf8-mode).
Setting any other non-empty string causes an error during i... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
67542125-e54b-5514-9117-b62e799eb9e9 | docs | python | python_cmdline | 310 | 43 | : If set, Python will print threading debug info into stdout.
Need a [debug build of Python](configure.html#debug-build).
Deprecated since version 3.10, will be removed in version 3.12.
`PYTHONDUMPREFS`[¶](#envvar-PYTHONDUMPREFS "Permalink to this definition")
: If set, Python will dump objects and refer... | large_dataset/raw/docs/python/cmdline/cmdline_310.md |
0fcabd06-2a16-553f-b4c2-b074f8ef1d23 | docs | python | python_cmdline | 311 | 0 | # 1.Command line and environment¶
Source: https://docs.python.org/3.11/using/cmdline.html
Version: 3.11
The CPython interpreter scans the command line and the environment for various
settings.
**CPython implementation detail:** Other implementations’ command line schemes may differ. See
[Alternate Implementations](.... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
b8070ec2-ed2c-575d-8bd6-a6a7c5f61e1b | docs | python | python_cmdline | 311 | 1 | commands and executes them until an EOF (an end-of-file character, you can
produce that with `Ctrl-D` on UNIX or `Ctrl-Z, Enter` on Windows) is read.
* When called with a file name argument or with a file as standard input, it
reads and executes a script from that file.
* When called with a directory name argumen... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
46adfe6f-1881-5b36-a6af-79459f3bc7ff | docs | python | python_cmdline | 311 | 2 | element, subscript zero (`sys.argv[0]`), is a string reflecting the program’s
source.
-c <command>[¶](#cmdoption-c "Link to this definition")
: Execute the Python code in *command*. *command* can be one or more
statements separated by newlines, with significant leading whitespace as in
normal module code.
... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
c112d45f-61f1-5100-bcc3-d941e35e885c | docs | python | python_cmdline | 311 | 3 | the [`__main__`](../library/__main__.html#module-__main__ "__main__: The environment where top-level code is run. Covers command-line interfaces, import-time behavior, and ``__name__ == '__main__'``.") module.
Since the argument is a *module* name, you must not give a file extension
(`.py`). The module nam... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
6c924839-7f15-5513-9467-30d50e049617 | docs | python | python_cmdline | 311 | 4 | can still be used for precompiled modules, even if the original source
file is not available.
If this option is given, the first element of [`sys.argv`](../library/sys.html#sys.argv "sys.argv") will be the
full path to the module file (while the module file is being located, the
first element will ... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
aba07169-6a67-5f09-8d74-bef2770e10ff | docs | python | python_cmdline | 311 | 5 | python -m timeit -s 'setup here' 'benchmarked code here'
python -m timeit -h # for details
```
Raises an [auditing event](../library/sys.html#auditing) `cpython.run_module` with argument `module-name`.
See also
[`runpy.run_module()`](../library/runpy.html#runpy.run_module "runpy.run_module")
... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
2fac9811-1e4f-55bb-927b-ece44a59505b | docs | python | python_cmdline | 311 | 6 | [`sys.path`](../library/sys.html#sys.path "sys.path").
Raises an [auditing event](../library/sys.html#auditing) `cpython.run_stdin` with no arguments.
<script>
: Execute the Python code contained in *script*, which must be a filesystem
path (absolute or relative) referring to either a Python file, a dir... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
f6356327-138c-56b0-a1df-a663bd785264 | docs | python | python_cmdline | 311 | 7 | If the script name refers to a directory or zipfile, the script name is
added to the start of [`sys.path`](../library/sys.html#sys.path "sys.path") and the `__main__.py` file in
that location is executed as the [`__main__`](../library/__main__.html#module-__main__ "__main__: The environment where top-level ... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
770a9f6b-f078-54f4-b698-2c43eed15faf | docs | python | python_cmdline | 311 | 8 | If no interface option is given, [`-i`](#cmdoption-i) is implied, `sys.argv[0]` is
an empty string (`""`) and the current directory will be added to the
start of [`sys.path`](../library/sys.html#sys.path "sys.path"). Also, tab-completion and history editing is
automatically enabled, if available on your platform (see
[... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
b938fe1f-516a-56d1-bc67-204f3790db00 | docs | python | python_cmdline | 311 | 9 | and exit.
New in version 3.11.
--help-xoptions[¶](#cmdoption-help-xoptions "Link to this definition")
: Print a description of implementation-specific [`-X`](#cmdoption-X) options
and exit.
New in version 3.11.
--help-all[¶](#cmdoption-help-all "Link to this definition")
: Print complete usage i... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
1974f123-c4e7-52ee-8e8b-93e57f3086b5 | docs | python | python_cmdline | 311 | 10 | ### 1.1.3. Miscellaneous options[¶](#miscellaneous-options "Link to this heading")
-b[¶](#cmdoption-b "Link to this definition")
: Issue a warning when converting [`bytes`](../library/stdtypes.html#bytes "bytes") or [`bytearray`](../library/stdtypes.html#bytearray "bytearray") to
[`str`](../library/stdtypes.html... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
73b8a551-39a4-5bc5-93df-2a160f1c7167 | docs | python | python_cmdline | 311 | 11 | : Control the validation behavior of hash-based `.pyc` files. See
[Cached bytecode invalidation](../reference/import.html#pyc-invalidation). When set to `default`, checked and unchecked
hash-based bytecode cache files are validated according to their default
semantics. When set to `always`, all hash-based... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
75a9c5b6-458c-5d61-ab90-2f6ffd0115ba | docs | python | python_cmdline | 311 | 12 | See also the [`-P`](#cmdoption-P) and [`-I`](#cmdoption-I) (isolated) options.
-i[¶](#cmdoption-i "Link to this definition")
: When a script is passed as first argument or the [`-c`](#cmdoption-c) option is used,
enter interactive mode after executing the script or the command, even when
[`sys.stdin`](..... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
2f362b5c-feb6-5810-b38d-60de581f34dd | docs | python | python_cmdline | 311 | 13 | variables are ignored, too. Further restrictions may be imposed to prevent
the user from injecting malicious code.
New in version 3.4.
-O[¶](#cmdoption-O "Link to this definition")
: Remove assert statements and any code conditional on the value of
[`__debug__`](../library/constants.html#debug__ "__... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
a180f087-1831-5c10-b730-01aa274e7fac | docs | python | python_cmdline | 311 | 14 | Changed in version 3.5: Modify `.pyc` filenames according to [**PEP 488**](https://peps.python.org/pep-0488/).
-P[¶](#cmdoption-P "Link to this definition")
: Don’t prepend a potentially unsafe path to [`sys.path`](../library/sys.html#sys.path "sys.path"):
* `python -m module` command line: Don’t prepend th... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
302631d1-018e-5540-bdb9-2c1d1c94ed14 | docs | python | python_cmdline | 311 | 15 | : Turn on hash randomization. This option only has an effect if the
[`PYTHONHASHSEED`](#envvar-PYTHONHASHSEED) environment variable is set to `0`, since hash
randomization is enabled by default.
On previous versions of Python, this option turns on hash randomization,
so that the [`__hash__()`](../ref... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
48208158-9e83-53e5-805a-45e2a056aa43 | docs | python | python_cmdline | 311 | 16 | Changed in version 3.7: The option is no longer ignored.
-s[¶](#cmdoption-s "Link to this definition")
: Don’t add the [`user site-packages directory`](../library/site.html#site.USER_SITE "site.USER_SITE") to
[`sys.path`](../library/sys.html#sys.path "sys.path").
See also [`PYTHONNOUSERSITE`](#envvar-PY... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
18b11b3b-4362-5217-99f1-08f8fff68804 | docs | python | python_cmdline | 311 | 17 | -u[¶](#cmdoption-u "Link to this definition")
: Force the stdout and stderr streams to be unbuffered. This option has no
effect on the stdin stream.
See also [`PYTHONUNBUFFERED`](#envvar-PYTHONUNBUFFERED).
Changed in version 3.7: The text layer of the stdout and stderr streams now is unbuffered.
-v[¶](... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
80766937-cccc-5b72-bb35-bef76d71d56c | docs | python | python_cmdline | 311 | 18 | : Warning control. Python’s warning machinery by default prints warning
messages to [`sys.stderr`](../library/sys.html#sys.stderr "sys.stderr").
The simplest settings apply a particular action unconditionally to all
warnings emitted by a process (even those that are otherwise ignored by
default):
... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
174c7991-f41f-543d-9614-30e6bb39557c | docs | python | python_cmdline | 311 | 19 | The *action* field is as explained above but only applies to warnings that
match the remaining fields.
The *message* field must match the whole warning message; this match is
case-insensitive.
The *category* field matches the warning category
(ex: `DeprecationWarning`). This must be a class na... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
e7cad211-2d9d-54ff-ba40-7e004da67215 | docs | python | python_cmdline | 311 | 20 | Warnings can also be controlled using the [`PYTHONWARNINGS`](#envvar-PYTHONWARNINGS)
environment variable and from within a Python program using the
[`warnings`](../library/warnings.html#module-warnings "warnings: Issue warning messages and control their disposition.") module. For example, the [`warnings.fi... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
45e395db-e3ca-5ea1-a9f9-6198b38cc122 | docs | python | python_cmdline | 311 | 21 | * `-X faulthandler` to enable [`faulthandler`](../library/faulthandler.html#module-faulthandler "faulthandler: Dump the Python traceback.").
See also [`PYTHONFAULTHANDLER`](#envvar-PYTHONFAULTHANDLER).
* `-X showrefcount` to output the total reference count and number of used
memory blocks when the ... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
58d8016a-b0cf-5b25-b6ab-05b80066d583 | docs | python | python_cmdline | 311 | 22 | * `-X int_max_str_digits` configures the [integer string conversion
length limitation](../library/stdtypes.html#int-max-str-digits). See also
[`PYTHONINTMAXSTRDIGITS`](#envvar-PYTHONINTMAXSTRDIGITS).
* `-X importtime` to show how long each import takes. It shows module
name, cumulative time (i... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
688d48f4-50fd-5d37-a277-c2c2bb70b402 | docs | python | python_cmdline | 311 | 23 | (even when it would otherwise activate automatically).
See also [`PYTHONUTF8`](#envvar-PYTHONUTF8).
* `-X pycache_prefix=PATH` enables writing `.pyc` files to a parallel
tree rooted at the given directory instead of to the code tree. See also
[`PYTHONPYCACHEPREFIX`](#envvar-PYTHONPYCACHEPREF... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
07dbe87b-e1a7-5c70-91a8-c33c612bcf95 | docs | python | python_cmdline | 311 | 24 | [`PYTHONNODEBUGRANGES`](#envvar-PYTHONNODEBUGRANGES).
* `-X frozen_modules` determines whether or not frozen modules are
ignored by the import machinery. A value of “on” means they get
imported and “off” means they are ignored. The default is “on”
if this is an installed Python (the normal c... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
1b9d1411-c646-531e-b6ef-b3e988d9cfd4 | docs | python | python_cmdline | 311 | 25 | Changed in version 3.7: Added the `-X importtime`, `-X dev` and `-X utf8` options.
Changed in version 3.8: Added the `-X pycache_prefix` option. The `-X dev` option now logs
`close()` exceptions in [`io.IOBase`](../library/io.html#io.IOBase "io.IOBase") destructor.
Changed in version 3.9: Using `-X de... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
f17d05f6-5db4-5d5e-aa7d-8ceb401eb436 | docs | python | python_cmdline | 311 | 26 | ## 1.2. Environment variables[¶](#environment-variables "Link to this heading")
These environment variables influence Python’s behavior, they are processed
before the command-line switches other than -E or -I. It is customary that
command-line switches override environmental variables where there is a
conflict.
PYTHO... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
9804144f-a637-54d6-8b60-d83a17c97b98 | docs | python | python_cmdline | 311 | 27 | : Augment the default search path for module files. The format is the same as
the shell’s `PATH`: one or more directory pathnames separated by
[`os.pathsep`](../library/os.html#os.pathsep "os.pathsep") (e.g. colons on Unix or semicolons on Windows).
Non-existent directories are silently ignored.
In a... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
1b3d5775-e9ed-545a-ad1b-cc87fab970b5 | docs | python | python_cmdline | 311 | 28 | within a Python program as the variable [`sys.path`](../library/sys.html#sys.path "sys.path").
PYTHONSAFEPATH[¶](#envvar-PYTHONSAFEPATH "Link to this definition")
: If this is set to a non-empty string, don’t prepend a potentially unsafe
path to [`sys.path`](../library/sys.html#sys.path "sys.path"): see the ... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
6fbdbce2-2981-592d-8bd9-14d4d918acf5 | docs | python | python_cmdline | 311 | 29 | the interactive session. You can also change the prompts [`sys.ps1`](../library/sys.html#sys.ps1 "sys.ps1") and
[`sys.ps2`](../library/sys.html#sys.ps2 "sys.ps2") and the hook [`sys.__interactivehook__`](../library/sys.html#sys.__interactivehook__ "sys.__interactivehook__") in this file.
Raises an [auditin... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
d3f5562f-3d41-5059-8b2d-0eb3945130c4 | docs | python | python_cmdline | 311 | 30 | by the default implementation of [`sys.breakpointhook()`](../library/sys.html#sys.breakpointhook "sys.breakpointhook") which itself is
called by built-in [`breakpoint()`](../library/functions.html#breakpoint "breakpoint"). If not set, or set to the empty
string, it is equivalent to the value “pdb.set\_trace... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
49a8e9ff-751c-51aa-8e45-1bd797962a94 | docs | python | python_cmdline | 311 | 31 | This variable can also be modified by Python code using [`os.environ`](../library/os.html#os.environ "os.environ")
to force inspect mode on program termination.
Raises an [auditing event](../library/sys.html#auditing) `cpython.run_stdin` with no arguments.
Changed in version 3.11.10: (also 3.10.15, 3.... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
ffb39c21-0be2-5759-8f8a-f6c39615e0d5 | docs | python | python_cmdline | 311 | 32 | only works on Windows and macOS.
PYTHONDONTWRITEBYTECODE[¶](#envvar-PYTHONDONTWRITEBYTECODE "Link to this definition")
: If this is set to a non-empty string, Python won’t try to write `.pyc`
files on the import of source modules. This is equivalent to
specifying the [`-B`](#cmdoption-B) option.
PYTHONP... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
1ea59612-3629-56f8-af21-33b97bef173c | docs | python | python_cmdline | 311 | 33 | seed for generating the hash() of the types covered by the hash
randomization.
Its purpose is to allow repeatable hashing, such as for selftests for the
interpreter itself, or to allow a cluster of python processes to share hash
values.
The integer must be a decimal number in the range [0,4294... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
bfc29bb8-451b-5428-b503-bfe57f9d11cb | docs | python | python_cmdline | 311 | 34 | the same meaning as in [`str.encode()`](../library/stdtypes.html#str.encode "str.encode").
For stderr, the `:errorhandler` part is ignored; the handler will always be
`'backslashreplace'`.
Changed in version 3.4: The `encodingname` part is now optional.
Changed in version 3.6: On Windows, the enc... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
a86f2584-4432-5a96-85bc-42064eb6a51a | docs | python | python_cmdline | 311 | 35 | : Defines the [`user base directory`](../library/site.html#site.USER_BASE "site.USER_BASE"), which is used to
compute the path of the [`user site-packages directory`](../library/site.html#site.USER_SITE "site.USER_SITE")
and [installation paths](../library/sysconfig.html#sysconfig-user-scheme) for
`python... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
41dbbd5e-3b9d-5850-a0ed-1b17db2d882f | docs | python | python_cmdline | 311 | 36 | The simplest settings apply a particular action unconditionally to all
warnings emitted by a process (even those that are otherwise ignored by
default):
```None
PYTHONWARNINGS=default # Warn once per call location
PYTHONWARNINGS=error # Convert to exceptions
PYTHONWARNINGS=always # Wa... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
2ac180a0-2003-5cbc-aa49-ee051481181f | docs | python | python_cmdline | 311 | 37 | [`SIGSEGV`](../library/signal.html#signal.SIGSEGV "signal.SIGSEGV"), [`SIGFPE`](../library/signal.html#signal.SIGFPE "signal.SIGFPE"),
[`SIGABRT`](../library/signal.html#signal.SIGABRT "signal.SIGABRT"), [`SIGBUS`](../library/signal.html#signal.SIGBUS "signal.SIGBUS") and
[`SIGILL`](../library/signal.html#s... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
72b9fe37-b628-5a73-94f1-0ce8b91079f4 | docs | python | python_cmdline | 311 | 38 | See the [`tracemalloc.start()`](../library/tracemalloc.html#tracemalloc.start "tracemalloc.start") function for more information.
This is equivalent to setting the [`-X`](#cmdoption-X) `tracemalloc` option.
New in version 3.4.
PYTHONPROFILEIMPORTTIME[¶](#envvar-PYTHONPROFILEIMPORTTIME "Link to this defini... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
d5b1bec4-91b2-5991-a729-e61f24a32355 | docs | python | python_cmdline | 311 | 39 | Set the family of memory allocators used by Python:
* `default`: use the [default memory allocators](../c-api/memory.html#default-memory-allocators).
* `malloc`: use the `malloc()` function of the C library
for all domains ([`PYMEM_DOMAIN_RAW`](../c-api/memory.html#c.PYMEM_DOMAIN_RAW "PYMEM_DOMAIN_RA... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
f6051910-cf26-58e7-90e3-abaf539e488a | docs | python | python_cmdline | 311 | 40 | * `debug`: install debug hooks on top of the [default memory
allocators](../c-api/memory.html#default-memory-allocators).
* `malloc_debug`: same as `malloc` but also install debug hooks.
* `pymalloc_debug`: same as `pymalloc` but also install debug hooks.
New in version 3.6.
Changed in versi... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
4784a03f-5c51-5e60-85b0-f792aa038de3 | docs | python | python_cmdline | 311 | 41 | PYTHONLEGACYWINDOWSFSENCODING[¶](#envvar-PYTHONLEGACYWINDOWSFSENCODING "Link to this definition")
: If set to a non-empty string, the default [filesystem encoding and
error handler](../glossary.html#term-filesystem-encoding-and-error-handler) mode will revert to their pre-3.6 values of ‘mbcs’ and
‘replace’, r... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
f7fb0bf9-81fe-528c-9aec-06ff683c53e6 | docs | python | python_cmdline | 311 | 42 | the active console code page, rather than using utf-8.
This variable is ignored if the standard streams are redirected (to files
or pipes) rather than referring to console buffers.
[Availability](../library/intro.html#availability): Windows.
New in version 3.6.
PYTHONCOERCECLOCALE[¶](#envvar-PYT... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
f3611e48-c9f8-527e-8fc5-c9a50dd8d0e3 | docs | python | python_cmdline | 311 | 43 | * `C.UTF-8`
* `C.utf8`
* `UTF-8`
If setting one of these locale categories succeeds, then the `LC_CTYPE`
environment variable will also be set accordingly in the current process
environment before the Python runtime is initialized. This ensures that in
addition to being seen by both the int... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
8c4e4c6d-ecfc-552b-8df5-1fe1cd91e5fe | docs | python | python_cmdline | 311 | 44 | [error handler](../library/codecs.html#error-handlers) for [`sys.stdin`](../library/sys.html#sys.stdin "sys.stdin") and
[`sys.stdout`](../library/sys.html#sys.stdout "sys.stdout") ([`sys.stderr`](../library/sys.html#sys.stderr "sys.stderr") continues to use `backslashreplace`
as it does in any other locale)... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
70851196-297b-5546-a3d6-7b327ae84627 | docs | python | python_cmdline | 311 | 45 | order to force the interpreter to use `ASCII` instead of `UTF-8` for
system interfaces.
[Availability](../library/intro.html#availability): Unix.
New in version 3.7: See [**PEP 538**](https://peps.python.org/pep-0538/) for more details.
PYTHONDEVMODE[¶](#envvar-PYTHONDEVMODE "Link to this definition"... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
cbd31c06-6c87-5dec-8b8b-e7a3d90518b0 | docs | python | python_cmdline | 311 | 46 | PYTHONWARNDEFAULTENCODING[¶](#envvar-PYTHONWARNDEFAULTENCODING "Link to this definition")
: If this environment variable is set to a non-empty string, issue a
[`EncodingWarning`](../library/exceptions.html#EncodingWarning "EncodingWarning") when the locale-specific default encoding is used.
See [Opt-in Encod... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
960a55ef-118d-5434-bacd-5dc4e17e94fd | docs | python | python_cmdline | 311 | 47 | ### 1.2.1. Debug-mode variables[¶](#debug-mode-variables "Link to this heading")
PYTHONTHREADDEBUG[¶](#envvar-PYTHONTHREADDEBUG "Link to this definition")
: If set, Python will print threading debug info into stdout.
Need a [debug build of Python](configure.html#debug-build).
Deprecated since version 3.10,... | large_dataset/raw/docs/python/cmdline/cmdline_311.md |
a1dbbd61-77ce-5152-9186-0772313a8783 | docs | python | python_cmdline | 311 | 48 | New in version 3.11.
| large_dataset/raw/docs/python/cmdline/cmdline_311.md |
211672f1-d8e7-53ed-8baa-595dbccd4a0d | docs | python | python_cmdline | 312 | 0 | # 1.Command line and environment¶
Source: https://docs.python.org/3.12/using/cmdline.html
Version: 3.12
The CPython interpreter scans the command line and the environment for various
settings.
**CPython implementation detail:** Other implementations’ command line schemes may differ. See
[Alternate Implementations](.... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
567e89a5-0865-5162-b21c-a998466c0cb5 | docs | python | python_cmdline | 312 | 1 | commands and executes them until an EOF (an end-of-file character, you can
produce that with `Ctrl`-`D` on UNIX or `Ctrl`-`Z,` `Enter` on Windows) is read.
* When called with a file name argument or with a file as standard input, it
reads and executes a script from that file.
* When called with a directory name a... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
c8286fd1-fdcc-5262-a914-7f99b09cab45 | docs | python | python_cmdline | 312 | 2 | element, subscript zero (`sys.argv[0]`), is a string reflecting the program’s
source.
-c <command>[¶](#cmdoption-c "Link to this definition")
: Execute the Python code in *command*. *command* can be one or more
statements separated by newlines, with significant leading whitespace as in
normal module code.
... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
051e3d84-a43d-5f20-bdee-fc6551d7b511 | docs | python | python_cmdline | 312 | 3 | the [`__main__`](../library/__main__.html#module-__main__ "__main__: The environment where top-level code is run. Covers command-line interfaces, import-time behavior, and ``__name__ == '__main__'``.") module.
Since the argument is a *module* name, you must not give a file extension
(`.py`). The module nam... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
37b06549-ef0b-53be-8082-410587cba0c2 | docs | python | python_cmdline | 312 | 4 | can still be used for precompiled modules, even if the original source
file is not available.
If this option is given, the first element of [`sys.argv`](../library/sys.html#sys.argv "sys.argv") will be the
full path to the module file (while the module file is being located, the
first element will ... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
a0d168ea-150d-5c2e-b512-439afaa36bac | docs | python | python_cmdline | 312 | 5 | python -m timeit -s "setup here" "benchmarked code here"
python -m timeit -h # for details
```
Raises an [auditing event](../library/sys.html#auditing) `cpython.run_module` with argument `module-name`.
See also
[`runpy.run_module()`](../library/runpy.html#runpy.run_module "runpy.run_module")
... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
defbff33-07f4-5bb8-b9bc-99ad32d4bd12 | docs | python | python_cmdline | 312 | 6 | [`sys.path`](../library/sys.html#sys.path "sys.path").
Raises an [auditing event](../library/sys.html#auditing) `cpython.run_stdin` with no arguments.
<script>
: Execute the Python code contained in *script*, which must be a filesystem
path (absolute or relative) referring to either a Python file, a dir... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
7917ede3-c584-562b-9aac-f9e5bf3d26ac | docs | python | python_cmdline | 312 | 7 | If the script name refers to a directory or zipfile, the script name is
added to the start of [`sys.path`](../library/sys.html#sys.path "sys.path") and the `__main__.py` file in
that location is executed as the [`__main__`](../library/__main__.html#module-__main__ "__main__: The environment where top-level ... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
c017bee0-281c-5626-92f1-62c67be88467 | docs | python | python_cmdline | 312 | 8 | If no interface option is given, [`-i`](#cmdoption-i) is implied, `sys.argv[0]` is
an empty string (`""`) and the current directory will be added to the
start of [`sys.path`](../library/sys.html#sys.path "sys.path"). Also, tab-completion and history editing is
automatically enabled, if available on your platform (see
[... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
e2724c99-92d6-58f9-a93d-e71b9efe0b78 | docs | python | python_cmdline | 312 | 9 | and exit.
Added in version 3.11.
--help-xoptions[¶](#cmdoption-help-xoptions "Link to this definition")
: Print a description of implementation-specific [`-X`](#cmdoption-X) options
and exit.
Added in version 3.11.
--help-all[¶](#cmdoption-help-all "Link to this definition")
: Print complete usa... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
f51e5d1d-5fb1-5b3f-babb-fb4a2532c461 | docs | python | python_cmdline | 312 | 10 | ### 1.1.3. Miscellaneous options[¶](#miscellaneous-options "Link to this heading")
-b[¶](#cmdoption-b "Link to this definition")
: Issue a warning when converting [`bytes`](../library/stdtypes.html#bytes "bytes") or [`bytearray`](../library/stdtypes.html#bytearray "bytearray") to
[`str`](../library/stdtypes.html... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
1487617a-5f0b-58cc-b61c-613d498c9675 | docs | python | python_cmdline | 312 | 11 | : Control the validation behavior of hash-based `.pyc` files. See
[Cached bytecode invalidation](../reference/import.html#pyc-invalidation). When set to `default`, checked and unchecked
hash-based bytecode cache files are validated according to their default
semantics. When set to `always`, all hash-based... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
8fdc738d-826d-5f6e-a6b0-acf1afaf4dc5 | docs | python | python_cmdline | 312 | 12 | [`PYTHONPATH`](#envvar-PYTHONPATH) and [`PYTHONHOME`](#envvar-PYTHONHOME), that might be set.
See also the [`-P`](#cmdoption-P) and [`-I`](#cmdoption-I) (isolated) options.
-i[¶](#cmdoption-i "Link to this definition")
: Enter interactive mode after execution.
Using the [`-i`](#cmdoption-i) option will... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
504ac0c0-b8ef-5aa5-af24-7eb30d6957bc | docs | python | python_cmdline | 312 | 13 | : Run Python in isolated mode. This also implies [`-E`](#cmdoption-E), [`-P`](#cmdoption-P)
and [`-s`](#cmdoption-s) options.
In isolated mode [`sys.path`](../library/sys.html#sys.path "sys.path") contains neither the script’s directory nor
the user’s site-packages directory. All `PYTHON*` environment
... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
22c7d2e0-ea64-5434-beb1-9038bd4ec684 | docs | python | python_cmdline | 312 | 14 | -OO[¶](#cmdoption-OO "Link to this definition")
: Do [`-O`](#cmdoption-O) and also discard docstrings. Augment the filename
for compiled ([bytecode](../glossary.html#term-bytecode)) files by adding `.opt-2` before the
`.pyc` extension (see [**PEP 488**](https://peps.python.org/pep-0488/)).
Changed in ver... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
05aba434-e688-5a45-8148-2548ffc8eeda | docs | python | python_cmdline | 312 | 15 | See also the [`PYTHONSAFEPATH`](#envvar-PYTHONSAFEPATH) environment variable, and [`-E`](#cmdoption-E)
and [`-I`](#cmdoption-I) (isolated) options.
Added in version 3.11.
-q[¶](#cmdoption-q "Link to this definition")
: Don’t display the copyright and version messages even in interactive mode.
Added... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
fe9fff63-8490-5ce0-b107-e585a0f6d260 | docs | python | python_cmdline | 312 | 16 | Hash randomization is intended to provide protection against a
denial-of-service caused by carefully chosen inputs that exploit the worst
case performance of a dict construction, *O*(*n*2) complexity. See
<http://ocert.org/advisories/ocert-2011-003.html> for details.
[`PYTHONHASHSEED`](#envvar-PYTH... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
49c1ec6b-1531-5ca1-9e75-f2b8dab2165a | docs | python | python_cmdline | 312 | 17 | : Disable the import of the module [`site`](../library/site.html#module-site "site: Module responsible for site-specific configuration.") and the site-dependent
manipulations of [`sys.path`](../library/sys.html#sys.path "sys.path") that it entails. Also disable these
manipulations if [`site`](../library/site.... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
d08df75b-bb03-53bc-b216-d457a09fd07f | docs | python | python_cmdline | 312 | 18 | (filename or built-in module) from which it is loaded. When given twice
(`-vv`), print a message for each file that is checked for when
searching for a module. Also provides information on module cleanup at exit.
Changed in version 3.10: The [`site`](../library/site.html#module-site "site: Module respo... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
f56000cd-625c-58ca-8379-d205662ed4fe | docs | python | python_cmdline | 312 | 19 | -Wall # Same as -Walways
-Wmodule # Warn once per calling module
-Wonce # Warn once per Python process
-Wignore # Never warn
```
The action names can be abbreviated as desired and the interpreter will
resolve them to the appropriate action name. For example, `-Wi` is the
sa... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
81b67fb9-c1cf-5462-97cf-a62dd9e96d48 | docs | python | python_cmdline | 312 | 20 | specified warning category.
The *module* field matches the (fully qualified) module name; this match is
case-sensitive.
The *lineno* field matches the line number, where zero matches all line
numbers and is thus equivalent to an omitted line number.
Multiple [`-W`](#cmdoption-W) options can b... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
0ec028c7-bf95-5f42-a7cf-3de7827510e4 | docs | python | python_cmdline | 312 | 21 | function can be used to use a regular expression on the warning message.
See [The Warnings Filter](../library/warnings.html#warning-filter) and [Describing Warning Filters](../library/warnings.html#describing-warning-filters) for more
details.
-x[¶](#cmdoption-x "Link to this definition")
: Skip the fir... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
a49cc1a4-342d-54c9-8f0d-de19151dd4c3 | docs | python | python_cmdline | 312 | 22 | interactive interpreter. This only works on [debug builds](configure.html#debug-build).
Added in version 3.4.
* `-X tracemalloc` to start tracing Python memory allocations using the
[`tracemalloc`](../library/tracemalloc.html#module-tracemalloc "tracemalloc: Trace memory allocations.") module. By... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
4f4a7f99-575a-5e9b-a31f-b8626a63f8d5 | docs | python | python_cmdline | 312 | 23 | name, cumulative time (including nested imports) and self time (excluding
nested imports). Note that its output may be broken in multi-threaded
application. Typical usage is `python3 -X importtime -c 'import
asyncio'`. See also [`PYTHONPROFILEIMPORTTIME`](#envvar-PYTHONPROFILEIMPORTTIME).
... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
1fbf7d09-6495-5431-937a-9557d0b16563 | docs | python | python_cmdline | 312 | 24 | tree rooted at the given directory instead of to the code tree. See also
[`PYTHONPYCACHEPREFIX`](#envvar-PYTHONPYCACHEPREFIX).
Added in version 3.8.
* `-X warn_default_encoding` issues a [`EncodingWarning`](../library/exceptions.html#EncodingWarning "EncodingWarning") when the
locale-specif... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
c8fa3080-8017-5b68-a749-63485780a342 | docs | python | python_cmdline | 312 | 25 | * `-X frozen_modules` determines whether or not frozen modules are
ignored by the import machinery. A value of “on” means they get
imported and “off” means they are ignored. The default is “on”
if this is an installed Python (the normal case). If it’s under
development (running from the sour... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
6313928a-1e01-54b2-ad04-36277694fb9b | docs | python | python_cmdline | 312 | 26 | Added in version 3.12.
It also allows passing arbitrary values and retrieving them through the
[`sys._xoptions`](../library/sys.html#sys._xoptions "sys._xoptions") dictionary.
Added in version 3.2.
Changed in version 3.9: Removed the `-X showalloccount` option.
Changed in version 3.10: Rem... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
5c8f4dff-3754-5afe-9139-b37cfe4b74ee | docs | python | python_cmdline | 312 | 27 | libraries are searched in `prefix/lib/pythonversion` and
`exec_prefix/lib/pythonversion`, where `prefix` and
`exec_prefix` are installation-dependent directories, both defaulting
to `/usr/local`.
When [`PYTHONHOME`](#envvar-PYTHONHOME) is set to a single directory, its value replaces
both `pref... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
c7b0d148-7b7c-57c9-b83b-92583800bfd2 | docs | python | python_cmdline | 312 | 28 | compiled form). Extension modules cannot be imported from zipfiles.
The default search path is installation dependent, but generally begins with
`prefix/lib/pythonversion` (see [`PYTHONHOME`](#envvar-PYTHONHOME) above). It
is *always* appended to [`PYTHONPATH`](#envvar-PYTHONPATH).
An additional d... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
4128de0c-2a57-5518-8291-1573d6672c54 | docs | python | python_cmdline | 312 | 29 | : If this is set to a non-empty string, it overrides the [`sys.platlibdir`](../library/sys.html#sys.platlibdir "sys.platlibdir")
value.
Added in version 3.9.
PYTHONSTARTUP[¶](#envvar-PYTHONSTARTUP "Link to this definition")
: If this is the name of a readable file, the Python commands in that file are
... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
66994478-3852-5228-8e52-55b812a4b9e9 | docs | python | python_cmdline | 312 | 30 | PYTHONOPTIMIZE[¶](#envvar-PYTHONOPTIMIZE "Link to this definition")
: If this is set to a non-empty string it is equivalent to specifying the
[`-O`](#cmdoption-O) option. If set to an integer, it is equivalent to specifying
[`-O`](#cmdoption-O) multiple times.
PYTHONBREAKPOINT[¶](#envvar-PYTHONBREAKPOINT "Li... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
32658035-b934-5a4b-b0f1-096560b0c6bd | docs | python | python_cmdline | 312 | 31 |
Added in version 3.7.
PYTHONDEBUG[¶](#envvar-PYTHONDEBUG "Link to this definition")
: If this is set to a non-empty string it is equivalent to specifying the
[`-d`](#cmdoption-d) option. If set to an integer, it is equivalent to specifying
[`-d`](#cmdoption-d) multiple times.
This environment varia... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
6bf9c32b-2add-5fbe-9c4c-6d629476fc09 | docs | python | python_cmdline | 312 | 32 | PYTHONUNBUFFERED[¶](#envvar-PYTHONUNBUFFERED "Link to this definition")
: If this is set to a non-empty string it is equivalent to specifying the
[`-u`](#cmdoption-u) option.
PYTHONVERBOSE[¶](#envvar-PYTHONVERBOSE "Link to this definition")
: If this is set to a non-empty string it is equivalent to specifying ... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
038a50cd-3b67-503d-ad94-0aa243db96df | docs | python | python_cmdline | 312 | 33 | : If this is set, Python will write `.pyc` files in a mirror directory tree
at this path, instead of in `__pycache__` directories within the source
tree. This is equivalent to specifying the [`-X`](#cmdoption-X)
`pycache_prefix=PATH` option.
Added in version 3.8.
PYTHONHASHSEED[¶](#envvar-PYTHONHASH... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
bd93aa2d-7544-5eac-b02e-2294c024742d | docs | python | python_cmdline | 312 | 34 | PYTHONINTMAXSTRDIGITS[¶](#envvar-PYTHONINTMAXSTRDIGITS "Link to this definition")
: If this variable is set to an integer, it is used to configure the
interpreter’s global [integer string conversion length limitation](../library/stdtypes.html#int-max-str-digits).
Added in version 3.11.
PYTHONIOENCODING[¶](#... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
e89ff30a-315f-5ec7-a0dd-b9ecc7edbdaa | docs | python | python_cmdline | 312 | 35 | console buffers unless [`PYTHONLEGACYWINDOWSSTDIO`](#envvar-PYTHONLEGACYWINDOWSSTDIO) is also specified.
Files and pipes redirected through the standard streams are not affected.
PYTHONNOUSERSITE[¶](#envvar-PYTHONNOUSERSITE "Link to this definition")
: If this is set, Python won’t add the [`user site-package... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
eec057bc-d4dd-5484-ae62-693a562b6e7a | docs | python | python_cmdline | 312 | 36 | [**PEP 370**](https://peps.python.org/pep-0370/) – Per user site-packages directory
PYTHONEXECUTABLE[¶](#envvar-PYTHONEXECUTABLE "Link to this definition")
: If this environment variable is set, `sys.argv[0]` will be set to its
value instead of the value got through the C runtime. Only works on
macOS.
P... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
485c0cd8-f7b9-562a-bdde-a5be375dac7c | docs | python | python_cmdline | 312 | 37 | PYTHONWARNINGS=all # Same as PYTHONWARNINGS=always
PYTHONWARNINGS=module # Warn once per calling module
PYTHONWARNINGS=once # Warn once per Python process
PYTHONWARNINGS=ignore # Never warn
```
See [The Warnings Filter](../library/warnings.html#warning-filter) and [Describing Warni... | large_dataset/raw/docs/python/cmdline/cmdline_312.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.