annotate Doc/using/cmdline.rst @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents f52159f87332
children 2aeed4ecad5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
d7279c321bb7 Change title, for now.
Georg Brandl <georg@python.org>
parents: 43614
diff changeset
5 Command line and environment
d7279c321bb7 Change title, for now.
Georg Brandl <georg@python.org>
parents: 43614
diff changeset
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
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
11 .. note::
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
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
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
24 python [-dEiOQsStuUvxX3?] [-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.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
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.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
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
51450
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
81 Package names are also permitted. When a package name is supplied instead
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
82 of a normal module, the interpreter will execute ``<pkg>.__main__`` as
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
83 the main module. This behaviour is deliberately similar to the handling
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
84 of directories and zipfiles that are passed to the interpreter as the
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
85 script argument.
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
86
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
87 .. note::
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
88
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
89 This option cannot be used with builtin 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
90 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
91 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
92 file is not available.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
93
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
94 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
95 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
96 directory will be added to the start of :data:`sys.path`.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
97
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
98 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
99 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
100
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
101 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
102 python -mtimeit -h # for details
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
103
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
104 .. seealso::
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
105 :func:`runpy.run_module`
51450
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
106 Equivalent functionality directly available to Python code
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
107
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
108 :pep:`338` -- Executing modules as scripts
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
109
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
110 .. versionadded:: 2.4
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
111
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
112 .. 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
113 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
114
51450
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
115 .. versionchanged:: 2.7
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
116 Supply the package name to run a ``__main__`` submodule.
5cce99aa1f58 Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda)
Nick Coghlan <ncoghlan@gmail.com>
parents: 50644
diff changeset
117
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
118
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
119 .. describe:: -
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
120
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
121 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
122 a terminal, :option:`-i` is implied.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
123
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
124 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
125 ``"-"`` 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
126 :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
127
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
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 .. 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
130
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 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
132 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
133 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
134 ``__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
135
8f5c759e019c Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents: 45674
diff changeset
136 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
137 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
138
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 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
140 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
141 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
142
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 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
144 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
145 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
146
8f5c759e019c Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents: 45674
diff changeset
147 .. 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
148 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
149 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
150
8f5c759e019c Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
Nick Coghlan <ncoghlan@gmail.com>
parents: 45674
diff changeset
151 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
152 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
153 start of :data:`sys.path`.
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
154
49675
6238b6cf77f1 Merged revisions 67143 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49184
diff changeset
155 .. seealso:: :ref:`tut-invoking`
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
156
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
157
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
158 Generic options
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
159 ~~~~~~~~~~~~~~~
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 .. cmdoption:: -?
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
162 -h
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
163 --help
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 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
166
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
167 .. versionchanged:: 2.5
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
168 The ``--help`` variant.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
169
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
170
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
171 .. cmdoption:: -V
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
172 --version
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
173
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
174 Print the Python version number and exit. Example output could be::
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
175
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
176 Python 2.5.1
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
177
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
178 .. versionchanged:: 2.5
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
179 The ``--version`` variant.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
180
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
181
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
182 Miscellaneous options
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
183 ~~~~~~~~~~~~~~~~~~~~~
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
184
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
185 .. 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
186
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
187 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
188 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
189
599f22a349a2 Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents: 44126
diff changeset
190 .. 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
191
599f22a349a2 Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Georg Brandl <georg@python.org>
parents: 44126
diff changeset
192
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
193 .. cmdoption:: -d
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
194
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
195 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
196 options). See also :envvar:`PYTHONDEBUG`.
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
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
199 .. cmdoption:: -E
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
200
43617
c4cc3c2489a0 Clarify -E docs.
Georg Brandl <georg@python.org>
parents: 43615
diff changeset
201 Ignore all :envvar:`PYTHON*` environment variables, e.g.
43618
88997f082174 Even more clarification.
Georg Brandl <georg@python.org>
parents: 43617
diff changeset
202 :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
203
43617
c4cc3c2489a0 Clarify -E docs.
Georg Brandl <georg@python.org>
parents: 43615
diff changeset
204 .. versionadded:: 2.2
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
205
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
206
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
207 .. cmdoption:: -i
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 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
210 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
211 :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
212 :envvar:`PYTHONSTARTUP` file is not read.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
213
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
214 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
215 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
216
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 .. cmdoption:: -O
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 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
221 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
222 :envvar:`PYTHONOPTIMIZE`.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
223
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
224
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
225 .. cmdoption:: -OO
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
226
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
227 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
228
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
229
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
230 .. cmdoption:: -Q <arg>
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
231
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
232 Division control. The argument must be one of the following:
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
233
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
234 ``old``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
235 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
236 ``new``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
237 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
238 float
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
239 ``warn``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
240 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
241 ``warnall``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
242 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
243
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
244 .. seealso::
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
245 :file:`Tools/scripts/fixdiv.py`
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
246 for a use of ``warnall``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
247
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
248 :pep:`238` -- Changing the division operator
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
249
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
250
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
251 .. cmdoption:: -s
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
252
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
253 Don't add user site directory to sys.path
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
254
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
255 .. versionadded:: 2.6
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
256
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
257 .. seealso::
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
258
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
259 :pep:`370` -- Per user site-packages directory
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
260
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
261
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
262 .. cmdoption:: -S
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
263
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
264 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
265 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
266
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
267
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
268 .. cmdoption:: -t
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
269
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
270 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
271 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
272 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
273
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
274
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
275 .. cmdoption:: -u
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
276
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
277 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
278 matters, also put stdin, stdout and stderr in binary mode.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
279
43714
33480765f669 Use correct markup.
Georg Brandl <georg@python.org>
parents: 43631
diff changeset
280 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
281 :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
282 by this option. To work around this, you will want to use
43714
33480765f669 Use correct markup.
Georg Brandl <georg@python.org>
parents: 43631
diff changeset
283 :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
284
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
285 See also :envvar:`PYTHONUNBUFFERED`.
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 .. XXX should the -U option be documented?
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
289
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
290 .. cmdoption:: -v
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
291
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
292 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
293 (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
294 (: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
295 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
296 See also :envvar:`PYTHONVERBOSE`.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
297
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 .. cmdoption:: -W arg
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
300
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
301 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
302 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
303 form::
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
304
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
305 file:line: category: message
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
306
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
307 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
308 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
309
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
310 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
311 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
312 :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
313 invalid options when the first warning is issued).
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
314
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
315 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
316 :mod:`warnings` module.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
317
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
318 The simplest form of argument is one of the following action strings (or a
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
319 unique abbreviation):
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
320
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
321 ``ignore``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
322 Ignore all warnings.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
323 ``default``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
324 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
325 source line).
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
326 ``all``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
327 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
328 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
329 loop).
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
330 ``module``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
331 Print each warning only only the first time it occurs in each module.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
332 ``once``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
333 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
334 ``error``
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
335 Raise an exception instead of printing a warning message.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
336
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
337 The full form of argument is::
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
338
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
339 action:message:category:module:line
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 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
342 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
343 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
344 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
345 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
346 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
347 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
348 (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
349 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
350 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
351
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
352 .. 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
353 :mod:`warnings` -- the warnings module
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
354
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
355 :pep:`230` -- Warning framework
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
356
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
357
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
358 .. cmdoption:: -x
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
359
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
360 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
361 ``#!cmd``. This is intended for a DOS specific hack only.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
362
53507
f52159f87332 Remove ".. warning::" markup that doesnt contain warnings for users, rather todo items.
Georg Brandl <georg@python.org>
parents: 51450
diff changeset
363 .. 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
364
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
365
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
366 .. cmdoption:: -3
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
367
50644
d8b64c676bcb fix spelling
Benjamin Peterson <benjamin@python.org>
parents: 50642
diff changeset
368 Warn about Python 3.x incompatibilities which cannot be fixed trivially by
50642
edeb9038c405 specify what -3 warnings are about
Benjamin Peterson <benjamin@python.org>
parents: 50508
diff changeset
369 :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
370
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
371 * :meth:`dict.has_key`
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
372 * :func:`apply`
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
373 * :func:`callable`
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
374 * :func:`coerce`
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
375 * :func:`execfile`
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
376 * :func:`reduce`
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
377 * :func:`reload`
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
378
45491
9b115c5e9115 Specify what kind of warning -3 emits.
Georg Brandl <georg@python.org>
parents: 44831
diff changeset
379 Using these will emit a :exc:`DeprecationWarning`.
9b115c5e9115 Specify what kind of warning -3 emits.
Georg Brandl <georg@python.org>
parents: 44831
diff changeset
380
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
381 .. versionadded:: 2.6
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
382
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
383
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
384
44097
823141adb080 Add "Using Python on Windows" document, by Robert Lehmann.
Georg Brandl <georg@python.org>
parents: 43714
diff changeset
385 .. _using-on-envvars:
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
386
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
387 Environment variables
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
388 ---------------------
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
389
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
390 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
391
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
392 .. envvar:: PYTHONHOME
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
393
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
394 Change the location of the standard Python libraries. By default, the
44831
c3bf8f9beaa7 Fix markup.
Georg Brandl <georg@python.org>
parents: 44578
diff changeset
395 libraries are searched in :file:`{prefix}/lib/python{version}` and
c3bf8f9beaa7 Fix markup.
Georg Brandl <georg@python.org>
parents: 44578
diff changeset
396 :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
397 :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
398 to :file:`/usr/local`.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
399
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
400 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
401 both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different values
44831
c3bf8f9beaa7 Fix markup.
Georg Brandl <georg@python.org>
parents: 44578
diff changeset
402 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
403
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
404
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
405 .. envvar:: PYTHONPATH
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
406
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
407 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
408 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
409 :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
410 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
411
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
412 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
413 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
414 compiled form). Extension modules cannot be imported from zipfiles.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
415
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
416 The default search path is installation dependent, but generally begins with
50459
8eddd665e9b9 #4811: fix markup glitches (mostly remains of the conversion),
Georg Brandl <georg@python.org>
parents: 49675
diff changeset
417 :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
418 is *always* appended to :envvar:`PYTHONPATH`.
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
419
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
420 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
421 :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
422 :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
423 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
424
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
425
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
426 .. envvar:: PYTHONSTARTUP
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
427
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
428 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
429 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
430 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
431 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
432 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
433 :data:`sys.ps2` in this file.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
434
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 .. envvar:: PYTHONY2K
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
437
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
438 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
439 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
440 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
441 documentation.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
442
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
443
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
444 .. envvar:: PYTHONOPTIMIZE
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
445
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
446 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
447 :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
448 :option:`-O` multiple times.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
449
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
450
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
451 .. envvar:: PYTHONDEBUG
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
452
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
453 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
454 :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
455 :option:`-d` multiple times.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
456
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
457
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
458 .. envvar:: PYTHONINSPECT
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
459
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
460 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
461 :option:`-i` option.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
462
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
463 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
464 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
465
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
466
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
467 .. envvar:: PYTHONUNBUFFERED
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
468
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
469 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
470 :option:`-u` option.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
471
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
472
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
473 .. envvar:: PYTHONVERBOSE
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
474
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
475 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
476 :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
477 :option:`-v` multiple times.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
478
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
479
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
480 .. envvar:: PYTHONCASEOK
50508
c52177f36852 Remove trailing whitespace.
Georg Brandl <georg@python.org>
parents: 50459
diff changeset
481
43614
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
482 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
483 only works on Windows.
252b9d22ca55 * Add new toplevel chapter, "Using Python." (how to install,
Georg Brandl <georg@python.org>
parents:
diff changeset
484
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
485
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
486 .. 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
487
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
488 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
489 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
490
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
491 .. versionadded:: 2.6
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
492
47413
1062b7dec95b New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents: 46698
diff changeset
493 .. envvar:: PYTHONIOENCODING
1062b7dec95b New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents: 46698
diff changeset
494
1062b7dec95b New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents: 46698
diff changeset
495 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
496 ``encodingname:errorhandler``. The ``:errorhandler`` part is optional and
72b4946c443a Clarify what ":errorhandler" refers to.
Georg Brandl <georg@python.org>
parents: 47413
diff changeset
497 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
498
1062b7dec95b New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents: 46698
diff changeset
499 .. versionadded:: 2.6
1062b7dec95b New environment variable PYTHONIOENCODING.
Martin v. Löwis <martin@v.loewis.de>
parents: 46698
diff changeset
500
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
501
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
502 .. envvar:: PYTHONNOUSERSITE
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
503
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
504 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
505
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
506 .. versionadded:: 2.6
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
507
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
508 .. seealso::
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
509
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
510 :pep:`370` -- Per user site-packages directory
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
511
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
512
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46603
diff changeset
513 .. envvar:: PYTHONUSERBASE
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 Sets the base directory for the user site directory
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
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
524 .. envvar:: PYTHONEXECUTABLE
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
525
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
526 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
527 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
528 Mac OS X.
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
529
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
530
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
531 Debug-mode variables
44578
19e1fa78d330 Fix two further doc build warnings.
Georg Brandl <georg@python.org>
parents: 44577
diff changeset
532 ~~~~~~~~~~~~~~~~~~~~
44569
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
533
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
534 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
535 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
536
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
537 .. envvar:: PYTHONTHREADDEBUG
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
538
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
539 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
540
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
541 .. versionchanged:: 2.6
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
542 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
543
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
544 .. envvar:: PYTHONDUMPREFS
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
545
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
546 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
547 shutting down the interpreter.
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
548
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
549
132d908471c8 patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
Georg Brandl <georg@python.org>
parents: 44566
diff changeset
550 .. envvar:: PYTHONMALLOCSTATS
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 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
553 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
554