Mercurial > cpython-lru_cache-weakref
annotate Doc/using/cmdline.rst @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | 26ca56b10c2b |
| children | 2f812212599b |
| rev | line source |
|---|---|
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
1 .. highlightlang:: none |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
2 |
|
60434
d79599b21e81
tell people to update python.man, too
Benjamin Peterson <benjamin@python.org>
parents:
60433
diff
changeset
|
3 .. ATTENTION: You probably should update Misc/python.man, too, if you modify |
|
d79599b21e81
tell people to update python.man, too
Benjamin Peterson <benjamin@python.org>
parents:
60433
diff
changeset
|
4 .. this file. |
|
d79599b21e81
tell people to update python.man, too
Benjamin Peterson <benjamin@python.org>
parents:
60433
diff
changeset
|
5 |
|
44097
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
6 .. _using-on-general: |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
7 |
| 43615 | 8 Command line and environment |
| 9 ============================ | |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
10 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
11 The CPython interpreter scans the command line and the environment for various |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
12 settings. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
13 |
|
56824
b7b8970cd5a5
Merged revisions 75363,75365,75376,75392,75394,75403,75418,75484,75572,75580,75590,75592,75594-75596,75600,75602-75603,75605-75607,75610-75613,75616-75617,75623,75627,75647 via svnmerge from
Georg Brandl <georg@python.org>
parents:
56818
diff
changeset
|
14 .. impl-detail:: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
15 |
|
44126
7e89f5cf6b21
#1548: fix apostroph placement.
Georg Brandl <georg@python.org>
parents:
44097
diff
changeset
|
16 Other implementations' command line schemes may differ. See |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
17 :ref:`implementations` for further resources. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
18 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
19 |
|
44097
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
20 .. _using-on-cmdline: |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
21 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
22 Command line |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
23 ------------ |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
24 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
25 When invoking Python, you may specify any of these options:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
26 |
|
75100
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
27 python [-BdEiOQsRStuUvVWxX3?] [-c command | -m module-name | script | - ] [args] |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
28 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
29 The most common use case is, of course, a simple invocation of a script:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
30 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
31 python myscript.py |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
32 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
33 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
34 .. _using-on-interface-options: |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
35 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
36 Interface options |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
37 ~~~~~~~~~~~~~~~~~ |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
38 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
39 The interpreter interface resembles that of the UNIX shell, but provides some |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
40 additional methods of invocation: |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
41 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
42 * When called with standard input connected to a tty device, it prompts for |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
43 commands and executes them until an EOF (an end-of-file character, you can |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
44 produce that with *Ctrl-D* on UNIX or *Ctrl-Z, Enter* on Windows) is read. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
45 * When called with a file name argument or with a file as standard input, it |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
46 reads and executes a script from that file. |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
47 * When called with a directory name argument, it reads and executes an |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
48 appropriately named script from that directory. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
49 * When called with ``-c command``, it executes the Python statement(s) given as |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
50 *command*. Here *command* may contain multiple statements separated by |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
51 newlines. Leading whitespace is significant in Python statements! |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
52 * When called with ``-m module-name``, the given module is located on the |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
53 Python module path and executed as a script. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
54 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
55 In non-interactive mode, the entire input is parsed before it is executed. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
56 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
57 An interface option terminates the list of options consumed by the interpreter, |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
58 all consecutive arguments will end up in :data:`sys.argv` -- note that the first |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
59 element, subscript zero (``sys.argv[0]``), is a string reflecting the program's |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
60 source. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
61 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
62 .. cmdoption:: -c <command> |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
63 |
|
62884
8aaaf01fcf03
Merged revisions 82548,82634-82635 via svnmerge from
Georg Brandl <georg@python.org>
parents:
58717
diff
changeset
|
64 Execute the Python code in *command*. *command* can be one or more |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
65 statements separated by newlines, with significant leading whitespace as in |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
66 normal module code. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
67 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
68 If this option is given, the first element of :data:`sys.argv` will be |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
69 ``"-c"`` and the current directory will be added to the start of |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
70 :data:`sys.path` (allowing modules in that directory to be imported as top |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
71 level modules). |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
72 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
73 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
74 .. cmdoption:: -m <module-name> |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
75 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
76 Search :data:`sys.path` for the named module and execute its contents as |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
77 the :mod:`__main__` module. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
78 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
79 Since the argument is a *module* name, you must not give a file extension |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
80 (``.py``). The ``module-name`` should be a valid Python module name, but |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
81 the implementation may not always enforce this (e.g. it may allow you to |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
82 use a name that includes a hyphen). |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
83 |
|
51450
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
84 Package names are also permitted. When a package name is supplied instead |
|
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
85 of a normal module, the interpreter will execute ``<pkg>.__main__`` as |
|
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
86 the main module. This behaviour is deliberately similar to the handling |
|
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
87 of directories and zipfiles that are passed to the interpreter as the |
|
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
88 script argument. |
|
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
89 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
90 .. note:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
91 |
|
56818
3e15a07a32fa
Merged revisions 74209 via svnmerge from
Georg Brandl <georg@python.org>
parents:
56814
diff
changeset
|
92 This option cannot be used with built-in modules and extension modules |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
93 written in C, since they do not have Python module files. However, it |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
94 can still be used for precompiled modules, even if the original source |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
95 file is not available. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
96 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
97 If this option is given, the first element of :data:`sys.argv` will be the |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
98 full path to the module file. As with the :option:`-c` option, the current |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
99 directory will be added to the start of :data:`sys.path`. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
100 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
101 Many standard library modules contain code that is invoked on their execution |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
102 as a script. An example is the :mod:`timeit` module:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
103 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
104 python -mtimeit -s 'setup here' 'benchmarked code here' |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
105 python -mtimeit -h # for details |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
106 |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
107 .. seealso:: |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
108 :func:`runpy.run_module` |
|
51450
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
109 Equivalent functionality directly available to Python code |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
110 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
111 :pep:`338` -- Executing modules as scripts |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
112 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
113 .. versionadded:: 2.4 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
114 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
115 .. versionchanged:: 2.5 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
116 The named module can now be located inside a package. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
117 |
|
51450
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
118 .. versionchanged:: 2.7 |
|
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
119 Supply the package name to run a ``__main__`` submodule. |
|
61054
c9e40cedc8bc
Add version changed note for -m tinkering with sys.argv[0] during the search process
Nick Coghlan <ncoghlan@gmail.com>
parents:
61053
diff
changeset
|
120 sys.argv[0] is now set to ``"-m"`` while searching for the module |
|
c9e40cedc8bc
Add version changed note for -m tinkering with sys.argv[0] during the search process
Nick Coghlan <ncoghlan@gmail.com>
parents:
61053
diff
changeset
|
121 (it was previously incorrectly set to ``"-c"``) |
|
51450
5cce99aa1f58
Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents:
50644
diff
changeset
|
122 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
123 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
124 .. describe:: - |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
125 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
126 Read commands from standard input (:data:`sys.stdin`). If standard input is |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
127 a terminal, :option:`-i` is implied. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
128 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
129 If this option is given, the first element of :data:`sys.argv` will be |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
130 ``"-"`` and the current directory will be added to the start of |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
131 :data:`sys.path`. |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
132 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
133 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
134 .. describe:: <script> |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
135 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
136 Execute the Python code contained in *script*, which must be a filesystem |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
137 path (absolute or relative) referring to either a Python file, a directory |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
138 containing a ``__main__.py`` file, or a zipfile containing a |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
139 ``__main__.py`` file. |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
140 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
141 If this option is given, the first element of :data:`sys.argv` will be the |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
142 script name as given on the command line. |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
143 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
144 If the script name refers directly to a Python file, the directory |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
145 containing that file is added to the start of :data:`sys.path`, and the |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
146 file is executed as the :mod:`__main__` module. |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
147 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
148 If the script name refers to a directory or zipfile, the script name is |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
149 added to the start of :data:`sys.path` and the ``__main__.py`` file in |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
150 that location is executed as the :mod:`__main__` module. |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
151 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
152 .. versionchanged:: 2.5 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
153 Directories and zipfiles containing a ``__main__.py`` file at the top |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
154 level are now considered valid Python scripts. |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
155 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
156 If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
157 an empty string (``""``) and the current directory will be added to the |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
158 start of :data:`sys.path`. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
159 |
|
49675
6238b6cf77f1
Merged revisions 67143 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49184
diff
changeset
|
160 .. seealso:: :ref:`tut-invoking` |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
161 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
162 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
163 Generic options |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
164 ~~~~~~~~~~~~~~~ |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
165 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
166 .. cmdoption:: -? |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
167 -h |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
168 --help |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
169 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
170 Print a short description of all command line options. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
171 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
172 .. versionchanged:: 2.5 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
173 The ``--help`` variant. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
174 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
175 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
176 .. cmdoption:: -V |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
177 --version |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
178 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
179 Print the Python version number and exit. Example output could be:: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
180 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
181 Python 2.5.1 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
182 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
183 .. versionchanged:: 2.5 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
184 The ``--version`` variant. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
185 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
186 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
187 Miscellaneous options |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
188 ~~~~~~~~~~~~~~~~~~~~~ |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
189 |
|
44566
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
190 .. cmdoption:: -B |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
191 |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
192 If given, Python won't try to write ``.pyc`` or ``.pyo`` files on the |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
193 import of source modules. See also :envvar:`PYTHONDONTWRITEBYTECODE`. |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
194 |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
195 .. versionadded:: 2.6 |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
196 |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
197 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
198 .. cmdoption:: -d |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
199 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
200 Turn on parser debugging output (for wizards only, depending on compilation |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
201 options). See also :envvar:`PYTHONDEBUG`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
202 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
203 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
204 .. cmdoption:: -E |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
205 |
| 43617 | 206 Ignore all :envvar:`PYTHON*` environment variables, e.g. |
| 43618 | 207 :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
208 |
| 43617 | 209 .. versionadded:: 2.2 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
210 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
211 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
212 .. cmdoption:: -i |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
213 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
214 When a script is passed as first argument or the :option:`-c` option is used, |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
215 enter interactive mode after executing the script or the command, even when |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
216 :data:`sys.stdin` does not appear to be a terminal. The |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
217 :envvar:`PYTHONSTARTUP` file is not read. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
218 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
219 This can be useful to inspect global variables or a stack trace when a script |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
220 raises an exception. See also :envvar:`PYTHONINSPECT`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
221 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
222 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
223 .. cmdoption:: -O |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
224 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
225 Turn on basic optimizations. This changes the filename extension for |
|
43627
faf5de69e977
Add :term:s for descriptors.
Georg Brandl <georg@python.org>
parents:
43618
diff
changeset
|
226 compiled (:term:`bytecode`) files from ``.pyc`` to ``.pyo``. See also |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
227 :envvar:`PYTHONOPTIMIZE`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
228 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
229 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
230 .. cmdoption:: -OO |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
231 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
232 Discard docstrings in addition to the :option:`-O` optimizations. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
233 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
234 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
235 .. cmdoption:: -Q <arg> |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
236 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
237 Division control. The argument must be one of the following: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
238 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
239 ``old`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
240 division of int/int and long/long return an int or long (*default*) |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
241 ``new`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
242 new division semantics, i.e. division of int/int and long/long returns a |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
243 float |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
244 ``warn`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
245 old division semantics with a warning for int/int and long/long |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
246 ``warnall`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
247 old division semantics with a warning for all uses of the division operator |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
248 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
249 .. seealso:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
250 :file:`Tools/scripts/fixdiv.py` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
251 for a use of ``warnall`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
252 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
253 :pep:`238` -- Changing the division operator |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
254 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
255 |
|
75100
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
256 .. cmdoption:: -R |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
257 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
258 Turn on hash randomization, so that the :meth:`__hash__` values of str, |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
259 bytes and datetime objects are "salted" with an unpredictable random value. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
260 Although they remain constant within an individual Python process, they are |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
261 not predictable between repeated invocations of Python. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
262 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
263 This is intended to provide protection against a denial-of-service caused by |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
264 carefully-chosen inputs that exploit the worst case performance of a dict |
|
75158
65d1fe86618f
Remove reST markup from --help output. Also: O(n**2) is dict construction, not single insertion.
Georg Brandl <georg@python.org>
parents:
75100
diff
changeset
|
265 construction, O(n^2) complexity. See |
|
75100
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
266 http://www.ocert.org/advisories/ocert-2011-003.html for details. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
267 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
268 Changing hash values affects the order in which keys are retrieved from a |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
269 dict. Although Python has never made guarantees about this ordering (and it |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
270 typically varies between 32-bit and 64-bit builds), enough real-world code |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
271 implicitly relies on this non-guaranteed behavior that the randomization is |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
272 disabled by default. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
273 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
274 See also :envvar:`PYTHONHASHSEED`. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
275 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
276 .. versionadded:: 2.6.8 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
277 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
278 |
|
46698
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
279 .. cmdoption:: -s |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
280 |
|
71957
b3f72b6450f1
Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents:
70734
diff
changeset
|
281 Don't add the :data:`user site-packages directory <site.USER_SITE>` to |
|
b3f72b6450f1
Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents:
70734
diff
changeset
|
282 :data:`sys.path`. |
|
46698
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
283 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
284 .. versionadded:: 2.6 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
285 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
286 .. seealso:: |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
287 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
288 :pep:`370` -- Per user site-packages directory |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
289 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
290 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
291 .. cmdoption:: -S |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
292 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
293 Disable the import of the module :mod:`site` and the site-dependent |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
294 manipulations of :data:`sys.path` that it entails. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
295 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
296 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
297 .. cmdoption:: -t |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
298 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
299 Issue a warning when a source file mixes tabs and spaces for indentation in a |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
300 way that makes it depend on the worth of a tab expressed in spaces. Issue an |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
301 error when the option is given twice (:option:`-tt`). |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
302 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
303 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
304 .. cmdoption:: -u |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
305 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
306 Force stdin, stdout and stderr to be totally unbuffered. On systems where it |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
307 matters, also put stdin, stdout and stderr in binary mode. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
308 |
| 43714 | 309 Note that there is internal buffering in :meth:`file.readlines` and |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
310 :ref:`bltin-file-objects` (``for line in sys.stdin``) which is not influenced |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
311 by this option. To work around this, you will want to use |
| 43714 | 312 :meth:`file.readline` inside a ``while 1:`` loop. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
313 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
314 See also :envvar:`PYTHONUNBUFFERED`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
315 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
316 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
317 .. cmdoption:: -v |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
318 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
319 Print a message each time a module is initialized, showing the place |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
320 (filename or built-in module) from which it is loaded. When given twice |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
321 (:option:`-vv`), print a message for each file that is checked for when |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
322 searching for a module. Also provides information on module cleanup at exit. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
323 See also :envvar:`PYTHONVERBOSE`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
324 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
325 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
326 .. cmdoption:: -W arg |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
327 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
328 Warning control. Python's warning machinery by default prints warning |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
329 messages to :data:`sys.stderr`. A typical warning message has the following |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
330 form:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
331 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
332 file:line: category: message |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
333 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
334 By default, each warning is printed once for each source line where it |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
335 occurs. This option controls how often warnings are printed. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
336 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
337 Multiple :option:`-W` options may be given; when a warning matches more than |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
338 one option, the action for the last matching option is performed. Invalid |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
339 :option:`-W` options are ignored (though, a warning message is printed about |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
340 invalid options when the first warning is issued). |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
341 |
|
62714
4d3b4f34192b
Update whatsnew/2.7.rst, add a few links and fix a couple of XXX. Also add a paragraph about DeprecationWarnings in cmdline.rst.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
62313
diff
changeset
|
342 Starting from Python 2.7, :exc:`DeprecationWarning` and its descendants |
|
4d3b4f34192b
Update whatsnew/2.7.rst, add a few links and fix a couple of XXX. Also add a paragraph about DeprecationWarnings in cmdline.rst.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
62313
diff
changeset
|
343 are ignored by default. The :option:`-Wd` option can be used to re-enable |
|
4d3b4f34192b
Update whatsnew/2.7.rst, add a few links and fix a couple of XXX. Also add a paragraph about DeprecationWarnings in cmdline.rst.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
62313
diff
changeset
|
344 them. |
|
4d3b4f34192b
Update whatsnew/2.7.rst, add a few links and fix a couple of XXX. Also add a paragraph about DeprecationWarnings in cmdline.rst.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
62313
diff
changeset
|
345 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
346 Warnings can also be controlled from within a Python program using the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
347 :mod:`warnings` module. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
348 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
349 The simplest form of argument is one of the following action strings (or a |
|
58053
42cfb727ff48
Merged revisions 77198 via svnmerge from
Brett Cannon <bcannon@gmail.com>
parents:
56824
diff
changeset
|
350 unique abbreviation) by themselves: |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
351 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
352 ``ignore`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
353 Ignore all warnings. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
354 ``default`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
355 Explicitly request the default behavior (printing each warning once per |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
356 source line). |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
357 ``all`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
358 Print a warning each time it occurs (this may generate many messages if a |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
359 warning is triggered repeatedly for the same source line, such as inside a |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
360 loop). |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
361 ``module`` |
|
56814
127d623396ab
Merged revisions 73286,73294,73296,73459,73462-73463,73544,73576-73577,73595-73596,73693-73694,73704-73705,73707,73713,73937-73940,73945,73951,73979 via svnmerge from
Georg Brandl <georg@python.org>
parents:
53573
diff
changeset
|
362 Print each warning only the first time it occurs in each module. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
363 ``once`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
364 Print each warning only the first time it occurs in the program. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
365 ``error`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
366 Raise an exception instead of printing a warning message. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
367 |
|
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
368 The full form of argument is:: |
|
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
369 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
370 action:message:category:module:line |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
371 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
372 Here, *action* is as explained above but only applies to messages that match |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
373 the remaining fields. Empty fields match all values; trailing empty fields |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
374 may be omitted. The *message* field matches the start of the warning message |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
375 printed; this match is case-insensitive. The *category* field matches the |
| 60489 | 376 warning category. This must be a class name; the match tests whether the |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
377 actual warning category of the message is a subclass of the specified warning |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
378 category. The full class name must be given. The *module* field matches the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
379 (fully-qualified) module name; this match is case-sensitive. The *line* |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
380 field matches the line number, where zero matches all line numbers and is |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
381 thus equivalent to an omitted line number. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
382 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
383 .. seealso:: |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
384 :mod:`warnings` -- the warnings module |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
385 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
386 :pep:`230` -- Warning framework |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
387 |
|
60433
c0957dada5c2
#7301: add the environment variable $PYTHONWARNINGS to supplement the -W
Philip Jenvey <pjenvey@underboss.org>
parents:
58716
diff
changeset
|
388 :envvar:`PYTHONWARNINGS` |
|
c0957dada5c2
#7301: add the environment variable $PYTHONWARNINGS to supplement the -W
Philip Jenvey <pjenvey@underboss.org>
parents:
58716
diff
changeset
|
389 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
390 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
391 .. cmdoption:: -x |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
392 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
393 Skip the first line of the source, allowing use of non-Unix forms of |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
394 ``#!cmd``. This is intended for a DOS specific hack only. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
395 |
|
53573
503f0f41f35f
Merged revisions 72007-72010,72036-72037 via svnmerge from
Georg Brandl <georg@python.org>
parents:
50786
diff
changeset
|
396 .. note:: The line numbers in error messages will be off by one. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
397 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
398 .. cmdoption:: -3 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
399 |
|
50786
2d453b221bec
Merged revisions 68292,68344,68361,68378,68424,68426,68429-68430,68450,68457,68480-68481,68493,68495,68499,68501,68512,68514-68515 via svnmerge from
Georg Brandl <georg@python.org>
parents:
50522
diff
changeset
|
400 Warn about Python 3.x incompatibilities which cannot be fixed trivially by |
|
2d453b221bec
Merged revisions 68292,68344,68361,68378,68424,68426,68429-68430,68450,68457,68480-68481,68493,68495,68499,68501,68512,68514-68515 via svnmerge from
Georg Brandl <georg@python.org>
parents:
50522
diff
changeset
|
401 :ref:`2to3 <2to3-reference>`. Among these are: |
|
44097
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
402 |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
403 * :meth:`dict.has_key` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
404 * :func:`apply` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
405 * :func:`callable` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
406 * :func:`coerce` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
407 * :func:`execfile` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
408 * :func:`reduce` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
409 * :func:`reload` |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
410 |
|
45491
9b115c5e9115
Specify what kind of warning -3 emits.
Georg Brandl <georg@python.org>
parents:
44831
diff
changeset
|
411 Using these will emit a :exc:`DeprecationWarning`. |
|
9b115c5e9115
Specify what kind of warning -3 emits.
Georg Brandl <georg@python.org>
parents:
44831
diff
changeset
|
412 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
413 .. versionadded:: 2.6 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
414 |
|
58717
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
415 Options you shouldn't use |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
416 ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
417 |
|
58717
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
418 .. cmdoption:: -J |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
419 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
420 Reserved for use by Jython_. |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
421 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
422 .. _Jython: http://jython.org |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
423 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
424 .. cmdoption:: -U |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
425 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
426 Turns all string literals into unicodes globally. Do not be tempted to use |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
427 this option as it will probably break your world. It also produces |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
428 ``.pyc`` files with a different magic number than normal. Instead, you can |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
429 enable unicode literals on a per-module basis by using:: |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
430 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
431 from __future__ import unicode_literals |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
432 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
433 at the top of the file. See :mod:`__future__` for details. |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
434 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
435 .. cmdoption:: -X |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
436 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
437 Reserved for alternative implementations of Python to use for their own |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
438 purposes. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
439 |
|
44097
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
440 .. _using-on-envvars: |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
441 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
442 Environment variables |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
443 --------------------- |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
444 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
445 These environment variables influence Python's behavior. |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
446 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
447 .. envvar:: PYTHONHOME |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
448 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
449 Change the location of the standard Python libraries. By default, the |
| 44831 | 450 libraries are searched in :file:`{prefix}/lib/python{version}` and |
| 451 :file:`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` and | |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
452 :file:`{exec_prefix}` are installation-dependent directories, both defaulting |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
453 to :file:`/usr/local`. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
454 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
455 When :envvar:`PYTHONHOME` is set to a single directory, its value replaces |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
456 both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different values |
| 44831 | 457 for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
458 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
459 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
460 .. envvar:: PYTHONPATH |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
461 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
462 Augment the default search path for module files. The format is the same as |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
463 the shell's :envvar:`PATH`: one or more directory pathnames separated by |
|
45674
42889b1a7dc2
#2239: PYTHONPATH delimiter is os.pathsep.
Georg Brandl <georg@python.org>
parents:
45491
diff
changeset
|
464 :data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows). |
|
42889b1a7dc2
#2239: PYTHONPATH delimiter is os.pathsep.
Georg Brandl <georg@python.org>
parents:
45491
diff
changeset
|
465 Non-existent directories are silently ignored. |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
466 |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
467 In addition to normal directories, individual :envvar:`PYTHONPATH` entries |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
468 may refer to zipfiles containing pure Python modules (in either source or |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
469 compiled form). Extension modules cannot be imported from zipfiles. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
470 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
471 The default search path is installation dependent, but generally begins with |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
472 :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). It |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
473 is *always* appended to :envvar:`PYTHONPATH`. |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
474 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
475 An additional directory will be inserted in the search path in front of |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
476 :envvar:`PYTHONPATH` as described above under |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
477 :ref:`using-on-interface-options`. The search path can be manipulated from |
|
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
478 within a Python program as the variable :data:`sys.path`. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
479 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
480 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
481 .. envvar:: PYTHONSTARTUP |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
482 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
483 If this is the name of a readable file, the Python commands in that file are |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
484 executed before the first prompt is displayed in interactive mode. The file |
|
43631
03056365a1b6
Add :term:s for "new-style class".
Georg Brandl <georg@python.org>
parents:
43627
diff
changeset
|
485 is executed in the same namespace where interactive commands are executed so |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
486 that objects defined or imported in it can be used without qualification in |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
487 the interactive session. You can also change the prompts :data:`sys.ps1` and |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
488 :data:`sys.ps2` in this file. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
489 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
490 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
491 .. envvar:: PYTHONY2K |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
492 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
493 Set this to a non-empty string to cause the :mod:`time` module to require |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
494 dates specified as strings to include 4-digit years, otherwise 2-digit years |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
495 are converted based on rules described in the :mod:`time` module |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
496 documentation. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
497 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
498 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
499 .. envvar:: PYTHONOPTIMIZE |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
500 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
501 If this is set to a non-empty string it is equivalent to specifying the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
502 :option:`-O` option. If set to an integer, it is equivalent to specifying |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
503 :option:`-O` multiple times. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
504 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
505 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
506 .. envvar:: PYTHONDEBUG |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
507 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
508 If this is set to a non-empty string it is equivalent to specifying the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
509 :option:`-d` option. If set to an integer, it is equivalent to specifying |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
510 :option:`-d` multiple times. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
511 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
512 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
513 .. envvar:: PYTHONINSPECT |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
514 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
515 If this is set to a non-empty string it is equivalent to specifying the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
516 :option:`-i` option. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
517 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
518 This variable can also be modified by Python code using :data:`os.environ` |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
519 to force inspect mode on program termination. |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
520 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
521 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
522 .. envvar:: PYTHONUNBUFFERED |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
523 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
524 If this is set to a non-empty string it is equivalent to specifying the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
525 :option:`-u` option. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
526 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
527 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
528 .. envvar:: PYTHONVERBOSE |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
529 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
530 If this is set to a non-empty string it is equivalent to specifying the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
531 :option:`-v` option. If set to an integer, it is equivalent to specifying |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
532 :option:`-v` multiple times. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
533 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
534 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
535 .. envvar:: PYTHONCASEOK |
|
50522
ee9ced92843a
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49675
diff
changeset
|
536 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
537 If this is set, Python ignores case in :keyword:`import` statements. This |
|
74637
f18662285248
Issue #13883: Document all platforms PYTHONCASEOK works on.
Brett Cannon <brett@python.org>
parents:
71958
diff
changeset
|
538 only works on Windows, OS X, OS/2, and RiscOS. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
539 |
|
44566
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
540 |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
541 .. envvar:: PYTHONDONTWRITEBYTECODE |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
542 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
543 If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the |
|
75275
26ca56b10c2b
State explicitely that PYTHONDONTWRITEBYTECODE is equivalent to -B
Éric Araujo <merwok@netwok.org>
parents:
75159
diff
changeset
|
544 import of source modules. This is equivalent to specifying the :option:`-B` |
|
26ca56b10c2b
State explicitely that PYTHONDONTWRITEBYTECODE is equivalent to -B
Éric Araujo <merwok@netwok.org>
parents:
75159
diff
changeset
|
545 option. |
|
44566
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
546 |
|
599f22a349a2
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents:
44126
diff
changeset
|
547 .. versionadded:: 2.6 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
548 |
|
75100
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
549 .. envvar:: PYTHONHASHSEED |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
550 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
551 If this variable is set to ``random``, the effect is the same as specifying |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
552 the :option:`-R` option: a random value is used to seed the hashes of str, |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
553 bytes and datetime objects. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
554 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
555 If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
556 fixed seed for generating the hash() of the types covered by the hash |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
557 randomization. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
558 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
559 Its purpose is to allow repeatable hashing, such as for selftests for the |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
560 interpreter itself, or to allow a cluster of python processes to share hash |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
561 values. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
562 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
563 The integer must be a decimal number in the range [0,4294967295]. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
564 Specifying the value 0 will lead to the same hash values as when hash |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
565 randomization is disabled. |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
566 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
567 .. versionadded:: 2.6.8 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
568 |
|
6b7704fe1be1
- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
Barry Warsaw <barry@python.org>
parents:
62884
diff
changeset
|
569 |
|
47413
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
570 .. envvar:: PYTHONIOENCODING |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
571 |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
572 Overrides the encoding used for stdin/stdout/stderr, in the syntax |
|
47603
72b4946c443a
Clarify what ":errorhandler" refers to.
Georg Brandl <georg@python.org>
parents:
47413
diff
changeset
|
573 ``encodingname:errorhandler``. The ``:errorhandler`` part is optional and |
|
72b4946c443a
Clarify what ":errorhandler" refers to.
Georg Brandl <georg@python.org>
parents:
47413
diff
changeset
|
574 has the same meaning as in :func:`str.encode`. |
|
47413
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
575 |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
576 .. versionadded:: 2.6 |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
577 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
578 |
|
46698
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
579 .. envvar:: PYTHONNOUSERSITE |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
580 |
|
71957
b3f72b6450f1
Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents:
70734
diff
changeset
|
581 If this is set, Python won't add the :data:`user site-packages directory |
|
b3f72b6450f1
Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents:
70734
diff
changeset
|
582 <site.USER_SITE>` to :data:`sys.path`. |
|
46698
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
583 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
584 .. versionadded:: 2.6 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
585 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
586 .. seealso:: |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
587 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
588 :pep:`370` -- Per user site-packages directory |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
589 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
590 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
591 .. envvar:: PYTHONUSERBASE |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
592 |
|
71957
b3f72b6450f1
Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents:
70734
diff
changeset
|
593 Defines the :data:`user base directory <site.USER_BASE>`, which is used to |
|
b3f72b6450f1
Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents:
70734
diff
changeset
|
594 compute the path of the :data:`user site-packages directory <site.USER_SITE>` |
|
71958
25a48fe791e6
Add documentation for PEP 370 features in distutils (#10745).
Éric Araujo <merwok@netwok.org>
parents:
71957
diff
changeset
|
595 and :ref:`Distutils installation paths <inst-alt-install-user>` for ``python |
|
25a48fe791e6
Add documentation for PEP 370 features in distutils (#10745).
Éric Araujo <merwok@netwok.org>
parents:
71957
diff
changeset
|
596 setup.py install --user``. |
|
46698
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
597 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
598 .. versionadded:: 2.6 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
599 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
600 .. seealso:: |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
601 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
602 :pep:`370` -- Per user site-packages directory |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
603 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
604 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
605 .. envvar:: PYTHONEXECUTABLE |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
606 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
607 If this environment variable is set, ``sys.argv[0]`` will be set to its |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
608 value instead of the value got through the C runtime. Only works on |
|
49184
59db4b3a06b0
Remove things specific to the old Macintosh, and spell "Mac OS X" consistently.
Georg Brandl <georg@python.org>
parents:
47603
diff
changeset
|
609 Mac OS X. |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
610 |
|
60433
c0957dada5c2
#7301: add the environment variable $PYTHONWARNINGS to supplement the -W
Philip Jenvey <pjenvey@underboss.org>
parents:
58716
diff
changeset
|
611 .. envvar:: PYTHONWARNINGS |
|
c0957dada5c2
#7301: add the environment variable $PYTHONWARNINGS to supplement the -W
Philip Jenvey <pjenvey@underboss.org>
parents:
58716
diff
changeset
|
612 |
| 60489 | 613 This is equivalent to the :option:`-W` option. If set to a comma |
|
60433
c0957dada5c2
#7301: add the environment variable $PYTHONWARNINGS to supplement the -W
Philip Jenvey <pjenvey@underboss.org>
parents:
58716
diff
changeset
|
614 separated string, it is equivalent to specifying :option:`-W` multiple |
|
c0957dada5c2
#7301: add the environment variable $PYTHONWARNINGS to supplement the -W
Philip Jenvey <pjenvey@underboss.org>
parents:
58716
diff
changeset
|
615 times. |
|
c0957dada5c2
#7301: add the environment variable $PYTHONWARNINGS to supplement the -W
Philip Jenvey <pjenvey@underboss.org>
parents:
58716
diff
changeset
|
616 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
617 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
618 Debug-mode variables |
|
44578
19e1fa78d330
Fix two further doc build warnings.
Georg Brandl <georg@python.org>
parents:
44577
diff
changeset
|
619 ~~~~~~~~~~~~~~~~~~~~ |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
620 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
621 Setting these variables only has an effect in a debug build of Python, that is, |
|
70734
7164bdfa0b0b
Fix a few misuses of :option: I missed in r86521.
Éric Araujo <merwok@netwok.org>
parents:
68256
diff
changeset
|
622 if Python was configured with the ``--with-pydebug`` build option. |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
623 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
624 .. envvar:: PYTHONTHREADDEBUG |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
625 |
|
46603
8f5c759e019c
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents:
45674
diff
changeset
|
626 If set, Python will print threading debug info. |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
627 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
628 .. versionchanged:: 2.6 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
629 Previously, this variable was called ``THREADDEBUG``. |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
630 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
631 .. envvar:: PYTHONDUMPREFS |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
632 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
633 If set, Python will dump objects and reference counts still alive after |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
634 shutting down the interpreter. |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
635 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
636 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
637 .. envvar:: PYTHONMALLOCSTATS |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
638 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
639 If set, Python will print memory allocation statistics every time a new |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
640 object arena is created, and on shutdown. |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
641 |
