Mercurial > cpython-lru_cache-weakref
annotate Doc/using/cmdline.rst @ 58925:eecf1bef052d 2.6
Merged revisions 78207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line
#7930: fix stripid
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Tue, 16 Feb 2010 23:29:44 +0000 |
| parents | 1cf16ce415ea |
| children | 8aaaf01fcf03 |
| 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 |
|
44097
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
3 .. _using-on-general: |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
4 |
| 43615 | 5 Command line and environment |
| 6 ============================ | |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
7 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
8 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
|
9 settings. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
10 |
|
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
|
11 .. 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
|
12 |
|
44126
7e89f5cf6b21
#1548: fix apostroph placement.
Georg Brandl <georg@python.org>
parents:
44097
diff
changeset
|
13 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
|
14 :ref:`implementations` for further resources. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
15 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
16 |
|
44097
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
17 .. _using-on-cmdline: |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
18 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
19 Command line |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
20 ------------ |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
21 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
22 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
|
23 |
|
58053
42cfb727ff48
Merged revisions 77198 via svnmerge from
Brett Cannon <bcannon@gmail.com>
parents:
56824
diff
changeset
|
24 python [-BdEiOQsStuUvVWxX3?] [-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
|
25 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
26 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
|
27 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
28 python myscript.py |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
29 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
30 |
|
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
|
31 .. _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
|
32 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
33 Interface options |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
34 ~~~~~~~~~~~~~~~~~ |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
35 |
|
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
|
36 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
|
37 additional methods of invocation: |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
38 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
39 * 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
|
40 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
|
41 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
|
42 * 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
|
43 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
|
44 * 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
|
45 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
|
46 * 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
|
47 *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
|
48 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
|
49 * 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
|
50 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
|
51 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
52 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
|
53 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 source. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
58 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
59 .. cmdoption:: -c <command> |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
60 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
61 Execute the Python code in *command*. *command* can be one ore more |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
62 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
|
63 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
|
64 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
65 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
|
66 ``"-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
|
67 :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
|
68 level modules). |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
69 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
70 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
71 .. cmdoption:: -m <module-name> |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
72 |
|
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
|
73 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
|
74 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
|
75 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
76 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
|
77 (``.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
|
78 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
|
79 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
|
80 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
81 .. note:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
82 |
|
56818
3e15a07a32fa
Merged revisions 74209 via svnmerge from
Georg Brandl <georg@python.org>
parents:
56814
diff
changeset
|
83 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
|
84 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
|
85 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
|
86 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
|
87 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
88 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
|
89 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
|
90 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
|
91 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
92 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
|
93 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
|
94 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
95 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
|
96 python -mtimeit -h # for details |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
97 |
|
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
|
98 .. seealso:: |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
99 :func:`runpy.run_module` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
100 The actual implementation of this feature. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
101 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
102 :pep:`338` -- Executing modules as scripts |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
103 |
|
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
|
104 .. versionadded:: 2.4 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
105 |
|
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
|
106 .. 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
|
107 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
|
108 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
109 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
110 .. describe:: - |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
111 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
112 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
|
113 a terminal, :option:`-i` is implied. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
114 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
115 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
|
116 ``"-"`` 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
|
117 :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
|
118 |
|
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
|
119 |
|
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
|
120 .. 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
|
121 |
|
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
|
122 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
|
123 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
|
124 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
|
125 ``__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
|
126 |
|
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
|
127 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
|
128 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
|
129 |
|
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 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
|
131 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
|
132 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
|
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 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
|
135 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
|
136 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
|
137 |
|
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 .. 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
|
139 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
|
140 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
|
141 |
|
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 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
|
143 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
|
144 start of :data:`sys.path`. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
145 |
|
49675
6238b6cf77f1
Merged revisions 67143 via svnmerge from
Georg Brandl <georg@python.org>
parents:
49184
diff
changeset
|
146 .. seealso:: :ref:`tut-invoking` |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
147 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
148 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
149 Generic options |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
150 ~~~~~~~~~~~~~~~ |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
151 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
152 .. cmdoption:: -? |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
153 -h |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
154 --help |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
155 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
156 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
|
157 |
|
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
|
158 .. versionchanged:: 2.5 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
159 The ``--help`` variant. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
160 |
|
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 .. cmdoption:: -V |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
163 --version |
|
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 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
|
166 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
167 Python 2.5.1 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
168 |
|
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
|
169 .. versionchanged:: 2.5 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
170 The ``--version`` variant. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
171 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
172 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
173 Miscellaneous options |
|
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 |
|
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
|
176 .. 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
|
177 |
|
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
|
178 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
|
179 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
|
180 |
|
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
|
181 .. 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
|
182 |
|
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
|
183 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
184 .. cmdoption:: -d |
|
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 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
|
187 options). See also :envvar:`PYTHONDEBUG`. |
|
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 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
190 .. cmdoption:: -E |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
191 |
| 43617 | 192 Ignore all :envvar:`PYTHON*` environment variables, e.g. |
| 43618 | 193 :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
|
194 |
| 43617 | 195 .. versionadded:: 2.2 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
196 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
197 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
198 .. cmdoption:: -i |
|
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 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
|
201 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
|
202 :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
|
203 :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
|
204 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
205 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
|
206 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
|
207 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
208 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
209 .. cmdoption:: -O |
|
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 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
|
212 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
|
213 :envvar:`PYTHONOPTIMIZE`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
214 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
215 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
216 .. cmdoption:: -OO |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
217 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
218 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
|
219 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
220 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
221 .. cmdoption:: -Q <arg> |
|
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 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
|
224 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
225 ``old`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
226 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
|
227 ``new`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
228 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
|
229 float |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
230 ``warn`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
231 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
|
232 ``warnall`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
233 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
|
234 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
235 .. seealso:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
236 :file:`Tools/scripts/fixdiv.py` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
237 for a use of ``warnall`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
238 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
239 :pep:`238` -- Changing the division operator |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
240 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
241 |
|
46698
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
242 .. cmdoption:: -s |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
243 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
244 Don't add user site directory to sys.path |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
245 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
246 .. versionadded:: 2.6 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
247 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
248 .. seealso:: |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
249 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
250 :pep:`370` -- Per user site-packages directory |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
251 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
252 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
253 .. cmdoption:: -S |
|
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 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
|
256 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
|
257 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
258 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
259 .. cmdoption:: -t |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
260 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
261 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
|
262 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
|
263 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
|
264 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
265 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
266 .. 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
|
267 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
268 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
|
269 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
|
270 |
| 43714 | 271 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
|
272 :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
|
273 by this option. To work around this, you will want to use |
| 43714 | 274 :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
|
275 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
276 See also :envvar:`PYTHONUNBUFFERED`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
277 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
278 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
279 .. 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
|
280 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
281 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
|
282 (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
|
283 (: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
|
284 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
|
285 See also :envvar:`PYTHONVERBOSE`. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
286 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
287 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
288 .. 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
|
289 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
290 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
|
291 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
|
292 form:: |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
293 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
294 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
|
295 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
296 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
|
297 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
|
298 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
299 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
|
300 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
|
301 :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
|
302 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
|
303 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
304 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
|
305 :mod:`warnings` module. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
306 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
307 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
|
308 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
|
309 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
310 ``ignore`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
311 Ignore all warnings. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
312 ``default`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
313 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
|
314 source line). |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
315 ``all`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
316 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
|
317 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
|
318 loop). |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
319 ``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
|
320 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
|
321 ``once`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
322 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
|
323 ``error`` |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
324 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
|
325 |
|
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
|
326 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
|
327 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
328 action:message:category:module:line |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
329 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
330 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
|
331 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
|
332 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
|
333 printed; this match is case-insensitive. The *category* field matches the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
334 warning category. This must be a class name; the match test whether the |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
335 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
|
336 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
|
337 (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
|
338 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
|
339 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
|
340 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
341 .. 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
|
342 :mod:`warnings` -- the warnings module |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
343 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
344 :pep:`230` -- Warning framework |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
345 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
346 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
347 .. 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
|
348 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
349 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
|
350 ``#!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
|
351 |
|
53573
503f0f41f35f
Merged revisions 72007-72010,72036-72037 via svnmerge from
Georg Brandl <georg@python.org>
parents:
50786
diff
changeset
|
352 .. 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
|
353 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
354 .. cmdoption:: -3 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
355 |
|
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
|
356 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
|
357 :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
|
358 |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
359 * :meth:`dict.has_key` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
360 * :func:`apply` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
361 * :func:`callable` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
362 * :func:`coerce` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
363 * :func:`execfile` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
364 * :func:`reduce` |
|
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
365 * :func:`reload` |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
366 |
|
45491
9b115c5e9115
Specify what kind of warning -3 emits.
Georg Brandl <georg@python.org>
parents:
44831
diff
changeset
|
367 Using these will emit a :exc:`DeprecationWarning`. |
|
9b115c5e9115
Specify what kind of warning -3 emits.
Georg Brandl <georg@python.org>
parents:
44831
diff
changeset
|
368 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
369 .. versionadded:: 2.6 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
370 |
|
58717
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
371 Options you shouldn't use |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
372 ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
373 |
|
58717
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
374 .. cmdoption:: -J |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
375 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
376 Reserved for use by Jython_. |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
377 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
378 .. _Jython: http://jython.org |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
379 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
380 .. cmdoption:: -U |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
381 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
382 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
|
383 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
|
384 ``.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
|
385 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
|
386 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
387 from __future__ import unicode_literals |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
388 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
389 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
|
390 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
391 .. cmdoption:: -X |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
392 |
|
1cf16ce415ea
Merged revisions 77992 via svnmerge from
Barry Warsaw <barry@python.org>
parents:
58053
diff
changeset
|
393 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
|
394 purposes. |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
395 |
|
44097
823141adb080
Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents:
43714
diff
changeset
|
396 .. _using-on-envvars: |
|
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 Environment variables |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
399 --------------------- |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
400 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
401 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
|
402 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
403 .. 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
|
404 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
405 Change the location of the standard Python libraries. By default, the |
| 44831 | 406 libraries are searched in :file:`{prefix}/lib/python{version}` and |
| 407 :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
|
408 :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
|
409 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
|
410 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
411 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
|
412 both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different values |
| 44831 | 413 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
|
414 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
415 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
416 .. envvar:: PYTHONPATH |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
417 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
418 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
|
419 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
|
420 :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
|
421 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
|
422 |
|
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
|
423 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
|
424 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
|
425 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
|
426 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
427 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
|
428 :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
|
429 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
|
430 |
|
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
|
431 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
|
432 :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
|
433 :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
|
434 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
|
435 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
436 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
437 .. 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
|
438 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
439 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
|
440 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
|
441 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
|
442 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
|
443 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
|
444 :data:`sys.ps2` in this file. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
445 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
446 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
447 .. 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
|
448 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
449 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
|
450 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
|
451 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
|
452 documentation. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
453 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
454 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
455 .. 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
|
456 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
457 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
|
458 :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
|
459 :option:`-O` multiple times. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
460 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
461 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
462 .. 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
|
463 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
464 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
|
465 :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
|
466 :option:`-d` multiple times. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
467 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
468 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
469 .. 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
|
470 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
471 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
|
472 :option:`-i` option. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
473 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
474 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
|
475 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
|
476 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
477 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
478 .. 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
|
479 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
480 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
|
481 :option:`-u` option. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
482 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
483 |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
484 .. 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
|
485 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
486 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
|
487 :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
|
488 :option:`-v` multiple times. |
|
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:: 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
|
492 |
|
43614
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
493 If this is set, Python ignores case in :keyword:`import` statements. This |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
494 only works on Windows. |
|
252b9d22ca55
* Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff
changeset
|
495 |
|
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
|
496 |
|
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
|
497 .. 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
|
498 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
499 If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the |
|
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
|
500 import of source modules. |
|
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
|
501 |
|
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
|
502 .. versionadded:: 2.6 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
503 |
|
47413
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
504 .. envvar:: PYTHONIOENCODING |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
505 |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
506 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
|
507 ``encodingname:errorhandler``. The ``:errorhandler`` part is optional and |
|
72b4946c443a
Clarify what ":errorhandler" refers to.
Georg Brandl <georg@python.org>
parents:
47413
diff
changeset
|
508 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
|
509 |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
510 .. versionadded:: 2.6 |
|
1062b7dec95b
New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents:
46698
diff
changeset
|
511 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
512 |
|
46698
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
513 .. envvar:: PYTHONNOUSERSITE |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
514 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
515 If this is set, Python won't add the user site directory to sys.path |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
516 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
517 .. versionadded:: 2.6 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
518 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
519 .. seealso:: |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
520 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
521 :pep:`370` -- Per user site-packages directory |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
522 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
523 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
524 .. envvar:: PYTHONUSERBASE |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
525 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
526 Sets the base directory for the user site directory |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
527 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
528 .. versionadded:: 2.6 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
529 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
530 .. seealso:: |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
531 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
532 :pep:`370` -- Per user site-packages directory |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
533 |
|
1a2dbc84bdfc
Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents:
46603
diff
changeset
|
534 |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
535 .. envvar:: PYTHONEXECUTABLE |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
536 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
537 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
|
538 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
|
539 Mac OS X. |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
540 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
541 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
542 Debug-mode variables |
|
44578
19e1fa78d330
Fix two further doc build warnings.
Georg Brandl <georg@python.org>
parents:
44577
diff
changeset
|
543 ~~~~~~~~~~~~~~~~~~~~ |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
544 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
545 Setting these variables only has an effect in a debug build of Python, that is, |
|
44578
19e1fa78d330
Fix two further doc build warnings.
Georg Brandl <georg@python.org>
parents:
44577
diff
changeset
|
546 if Python was configured with the :option:`--with-pydebug` build option. |
|
44569
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
547 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
548 .. envvar:: PYTHONTHREADDEBUG |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
549 |
|
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
|
550 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
|
551 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
552 .. versionchanged:: 2.6 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
553 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
|
554 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
555 .. envvar:: PYTHONDUMPREFS |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
556 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
557 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
|
558 shutting down the interpreter. |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
559 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
560 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
561 .. envvar:: PYTHONMALLOCSTATS |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
562 |
|
132d908471c8
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents:
44566
diff
changeset
|
563 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
|
564 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
|
565 |
