annotate Doc/using/cmdline.rst @ 78069:a8aa77458e12 3.2

Add c_size_t and c_ssize_t to the ctypes summary table.
author Antoine Pitrou <solipsis@pitrou.net>
date Thu, 12 Jul 2012 20:31:50 +0200
parents e832ffd0388f
children a8052ad9752b 69259657d5c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
1 .. highlightlang:: none
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
2
60436
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
3 .. ATTENTION: You probably should update Misc/python.man, too, if you modify
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
4 .. this file.
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
5
44104
ff1766eb2fce Merged revisions 59259-59274 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44052
diff changeset
6 .. _using-on-general:
ff1766eb2fce Merged revisions 59259-59274 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44052
diff changeset
7
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
8 Command line and environment
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
9 ============================
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
10
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
11 The CPython interpreter scans the command line and the environment for various
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
12 settings.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
13
56894
b085fd0611de Merged revisions 75797 via svnmerge from
Georg Brandl <georg@python.org>
parents: 55580
diff changeset
14 .. impl-detail::
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
15
44129
b637349336fd Merged revisions 59275-59303 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44104
diff changeset
16 Other implementations' command line schemes may differ. See
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
17 :ref:`implementations` for further resources.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
18
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
19
44104
ff1766eb2fce Merged revisions 59259-59274 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44052
diff changeset
20 .. _using-on-cmdline:
ff1766eb2fce Merged revisions 59259-59274 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44052
diff changeset
21
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
22 Command line
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
23 ------------
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
24
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
25 When invoking Python, you may specify any of these options::
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
26
75073
4a31f6b11e7a Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 74635 75066
diff changeset
27 python [-bBdEhiORqsSuvVWx?] [-c command | -m module-name | script | - ] [args]
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
28
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
29 The most common use case is, of course, a simple invocation of a script::
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
30
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
31 python myscript.py
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
32
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
33
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
34 .. _using-on-interface-options:
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
35
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
36 Interface options
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
37 ~~~~~~~~~~~~~~~~~
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
38
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
39 The interpreter interface resembles that of the UNIX shell, but provides some
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
40 additional methods of invocation:
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
41
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
42 * When called with standard input connected to a tty device, it prompts for
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
43 commands and executes them until an EOF (an end-of-file character, you can
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
44 produce that with *Ctrl-D* on UNIX or *Ctrl-Z, Enter* on Windows) is read.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
45 * When called with a file name argument or with a file as standard input, it
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
46 reads and executes a script from that file.
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
47 * When called with a directory name argument, it reads and executes an
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
48 appropriately named script from that directory.
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
49 * When called with ``-c command``, it executes the Python statement(s) given as
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
50 *command*. Here *command* may contain multiple statements separated by
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
51 newlines. Leading whitespace is significant in Python statements!
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
52 * When called with ``-m module-name``, the given module is located on the
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
53 Python module path and executed as a script.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
54
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
55 In non-interactive mode, the entire input is parsed before it is executed.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
56
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
57 An interface option terminates the list of options consumed by the interpreter,
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
58 all consecutive arguments will end up in :data:`sys.argv` -- note that the first
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
59 element, subscript zero (``sys.argv[0]``), is a string reflecting the program's
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
60 source.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
61
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
62 .. cmdoption:: -c <command>
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
63
65113
c9879b3402e4 Merged revisions 82262,82269,82434,82480-82481,82484-82485,82487-82488,82594,82599,82615 via svnmerge from
Georg Brandl <georg@python.org>
parents: 60149
diff changeset
64 Execute the Python code in *command*. *command* can be one or more
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
65 statements separated by newlines, with significant leading whitespace as in
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
66 normal module code.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
67
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
68 If this option is given, the first element of :data:`sys.argv` will be
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
69 ``"-c"`` and the current directory will be added to the start of
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
70 :data:`sys.path` (allowing modules in that directory to be imported as top
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
71 level modules).
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
72
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
73
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
74 .. cmdoption:: -m <module-name>
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
75
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
76 Search :data:`sys.path` for the named module and execute its contents as
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
77 the :mod:`__main__` module.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
78
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
79 Since the argument is a *module* name, you must not give a file extension
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
80 (``.py``). The ``module-name`` should be a valid Python module name, but
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
81 the implementation may not always enforce this (e.g. it may allow you to
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
82 use a name that includes a hyphen).
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
83
51452
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
84 Package names are also permitted. When a package name is supplied instead
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
85 of a normal module, the interpreter will execute ``<pkg>.__main__`` as
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
86 the main module. This behaviour is deliberately similar to the handling
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
87 of directories and zipfiles that are passed to the interpreter as the
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
88 script argument.
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
89
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
90 .. note::
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
91
55580
7b495c8f2a24 Merged revisions 73941-73943,74076,74094,74186,74211-74214,74247,74254,74262,74311,74334,74368 via svnmerge from
Georg Brandl <georg@python.org>
parents: 54841
diff changeset
92 This option cannot be used with built-in modules and extension modules
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
93 written in C, since they do not have Python module files. However, it
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
94 can still be used for precompiled modules, even if the original source
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
95 file is not available.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
96
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
97 If this option is given, the first element of :data:`sys.argv` will be the
64110
212a16f906a6 Issue #8202: Set sys.argv[0] to -m rather than -c while searching for the module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory
Nick Coghlan <ncoghlan@gmail.com>
parents: 62836
diff changeset
98 full path to the module file (while the module file is being located, the
212a16f906a6 Issue #8202: Set sys.argv[0] to -m rather than -c while searching for the module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory
Nick Coghlan <ncoghlan@gmail.com>
parents: 62836
diff changeset
99 first element will be set to ``"-m"``). As with the :option:`-c` option,
212a16f906a6 Issue #8202: Set sys.argv[0] to -m rather than -c while searching for the module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory
Nick Coghlan <ncoghlan@gmail.com>
parents: 62836
diff changeset
100 the current directory will be added to the start of :data:`sys.path`.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
101
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
102 Many standard library modules contain code that is invoked on their execution
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
103 as a script. An example is the :mod:`timeit` module::
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
104
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
105 python -mtimeit -s 'setup here' 'benchmarked code here'
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
106 python -mtimeit -h # for details
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
107
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
108 .. seealso::
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
109 :func:`runpy.run_module`
51452
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
110 Equivalent functionality directly available to Python code
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
111
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
112 :pep:`338` -- Executing modules as scripts
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
113
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
114
51452
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
115 .. versionchanged:: 3.1
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
116 Supply the package name to run a ``__main__`` submodule.
2d354f4d77bc Merged revisions 69419-69420 via svnmerge from
Nick Coghlan <ncoghlan@gmail.com>
parents: 50569
diff changeset
117
64112
990a766ff983 Consistency check for versionadded/changed directives.
Georg Brandl <georg@python.org>
parents: 64110
diff changeset
118
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
119 .. describe:: -
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
120
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
121 Read commands from standard input (:data:`sys.stdin`). If standard input is
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
122 a terminal, :option:`-i` is implied.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
123
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
124 If this option is given, the first element of :data:`sys.argv` will be
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
125 ``"-"`` and the current directory will be added to the start of
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
126 :data:`sys.path`.
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
127
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
128
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
129 .. describe:: <script>
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
130
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
131 Execute the Python code contained in *script*, which must be a filesystem
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
132 path (absolute or relative) referring to either a Python file, a directory
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
133 containing a ``__main__.py`` file, or a zipfile containing a
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
134 ``__main__.py`` file.
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
135
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
136 If this option is given, the first element of :data:`sys.argv` will be the
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
137 script name as given on the command line.
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
138
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
139 If the script name refers directly to a Python file, the directory
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
140 containing that file is added to the start of :data:`sys.path`, and the
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
141 file is executed as the :mod:`__main__` module.
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
142
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
143 If the script name refers to a directory or zipfile, the script name is
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
144 added to the start of :data:`sys.path` and the ``__main__.py`` file in
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
145 that location is executed as the :mod:`__main__` module.
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
146
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
147
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
148 If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
149 an empty string (``""``) and the current directory will be added to the
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
150 start of :data:`sys.path`.
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
151
49679
1f7f41f20ac5 Merged revisions 67117-67119,67123-67124,67143 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49669
diff changeset
152 .. seealso:: :ref:`tut-invoking`
1f7f41f20ac5 Merged revisions 67117-67119,67123-67124,67143 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49669
diff changeset
153
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
154
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
155 Generic options
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
156 ~~~~~~~~~~~~~~~
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
157
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
158 .. cmdoption:: -?
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
159 -h
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
160 --help
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
161
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
162 Print a short description of all command line options.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
163
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
164
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
165 .. cmdoption:: -V
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
166 --version
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
167
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
168 Print the Python version number and exit. Example output could be::
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
169
46963
03b1233bf5fe Remove many "versionchanged" items that didn't use the official markup,
Georg Brandl <georg@python.org>
parents: 46716
diff changeset
170 Python 3.0
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
171
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
172
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
173 Miscellaneous options
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
174 ~~~~~~~~~~~~~~~~~~~~~
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
175
44213
70cc7f740d34 Added -b option to the list of command line options
Christian Heimes <christian@cheimes.de>
parents: 44210
diff changeset
176 .. cmdoption:: -b
70cc7f740d34 Added -b option to the list of command line options
Christian Heimes <christian@cheimes.de>
parents: 44210
diff changeset
177
70cc7f740d34 Added -b option to the list of command line options
Christian Heimes <christian@cheimes.de>
parents: 44210
diff changeset
178 Issue a warning when comparing str and bytes. Issue an error when the
70cc7f740d34 Added -b option to the list of command line options
Christian Heimes <christian@cheimes.de>
parents: 44210
diff changeset
179 option is given twice (:option:`-bb`).
70cc7f740d34 Added -b option to the list of command line options
Christian Heimes <christian@cheimes.de>
parents: 44210
diff changeset
180
70cc7f740d34 Added -b option to the list of command line options
Christian Heimes <christian@cheimes.de>
parents: 44210
diff changeset
181
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
182 .. cmdoption:: -B
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
183
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
184 If given, Python won't try to write ``.pyc`` or ``.pyo`` files on the
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
185 import of source modules. See also :envvar:`PYTHONDONTWRITEBYTECODE`.
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
186
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
187
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
188 .. cmdoption:: -d
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
189
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
190 Turn on parser debugging output (for wizards only, depending on compilation
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
191 options). See also :envvar:`PYTHONDEBUG`.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
192
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
193
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
194 .. cmdoption:: -E
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
195
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
196 Ignore all :envvar:`PYTHON*` environment variables, e.g.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
197 :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
198
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
199
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
200 .. cmdoption:: -i
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
201
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
202 When a script is passed as first argument or the :option:`-c` option is used,
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
203 enter interactive mode after executing the script or the command, even when
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
204 :data:`sys.stdin` does not appear to be a terminal. The
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
205 :envvar:`PYTHONSTARTUP` file is not read.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
206
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
207 This can be useful to inspect global variables or a stack trace when a script
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
208 raises an exception. See also :envvar:`PYTHONINSPECT`.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
209
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
210
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
211 .. cmdoption:: -O
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
212
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
213 Turn on basic optimizations. This changes the filename extension for
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
214 compiled (:term:`bytecode`) files from ``.pyc`` to ``.pyo``. See also
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
215 :envvar:`PYTHONOPTIMIZE`.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
216
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
217
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
218 .. cmdoption:: -OO
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
219
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
220 Discard docstrings in addition to the :option:`-O` optimizations.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
221
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
222
66687
f35a6d7e325f #1772833: add -q command line option.
Georg Brandl <georg@python.org>
parents: 65575
diff changeset
223 .. cmdoption:: -q
f35a6d7e325f #1772833: add -q command line option.
Georg Brandl <georg@python.org>
parents: 65575
diff changeset
224
f35a6d7e325f #1772833: add -q command line option.
Georg Brandl <georg@python.org>
parents: 65575
diff changeset
225 Don't display the copyright and version messages even in interactive mode.
f35a6d7e325f #1772833: add -q command line option.
Georg Brandl <georg@python.org>
parents: 65575
diff changeset
226
f35a6d7e325f #1772833: add -q command line option.
Georg Brandl <georg@python.org>
parents: 65575
diff changeset
227 .. versionadded:: 3.2
f35a6d7e325f #1772833: add -q command line option.
Georg Brandl <georg@python.org>
parents: 65575
diff changeset
228
f35a6d7e325f #1772833: add -q command line option.
Georg Brandl <georg@python.org>
parents: 65575
diff changeset
229
75066
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
230 .. cmdoption:: -R
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
231
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
232 Turn on hash randomization, so that the :meth:`__hash__` values of str, bytes
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
233 and datetime objects are "salted" with an unpredictable random value.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
234 Although they remain constant within an individual Python process, they are
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
235 not predictable between repeated invocations of Python.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
236
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
237 This is intended to provide protection against a denial-of-service caused by
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
238 carefully-chosen inputs that exploit the worst case performance of a dict
75155
358aee0a9ad5 Remove reST markup from --help output. Also: O(n**2) is dict construction, not single insertion.
Georg Brandl <georg@python.org>
parents: 75066
diff changeset
239 construction, O(n^2) complexity. See
75066
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
240 http://www.ocert.org/advisories/ocert-2011-003.html for details.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
241
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
242 Changing hash values affects the order in which keys are retrieved from a
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
243 dict. Although Python has never made guarantees about this ordering (and it
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
244 typically varies between 32-bit and 64-bit builds), enough real-world code
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
245 implicitly relies on this non-guaranteed behavior that the randomization is
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
246 disabled by default.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
247
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
248 See also :envvar:`PYTHONHASHSEED`.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
249
75073
4a31f6b11e7a Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 74635 75066
diff changeset
250 .. versionadded:: 3.2.3
75066
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
251
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
252
46708
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
253 .. cmdoption:: -s
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
254
71778
74179a79d673 Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents: 70729
diff changeset
255 Don't add the :data:`user site-packages directory <site.USER_SITE>` to
74179a79d673 Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents: 70729
diff changeset
256 :data:`sys.path`.
46708
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
257
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
258 .. seealso::
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
259
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
260 :pep:`370` -- Per user site-packages directory
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
261
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
262
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
263 .. cmdoption:: -S
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
264
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
265 Disable the import of the module :mod:`site` and the site-dependent
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
266 manipulations of :data:`sys.path` that it entails.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
267
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
268
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
269 .. cmdoption:: -u
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
270
60149
b57da4a4a3ed #8213: document behavior of -u on py3k better.
Georg Brandl <georg@python.org>
parents: 58719
diff changeset
271 Force the binary layer of the stdin, stdout and stderr streams (which is
b57da4a4a3ed #8213: document behavior of -u on py3k better.
Georg Brandl <georg@python.org>
parents: 58719
diff changeset
272 available as their ``buffer`` attribute) to be unbuffered. The text I/O
74108
19df72a77b39 Issue #13597: Fix the documentation of the "-u" command-line option, and wording of "What's new in Python 3.0" about standard streams.
Antoine Pitrou <solipsis@pitrou.net>
parents: 73320
diff changeset
273 layer will still be line-buffered if writing to the console, or
19df72a77b39 Issue #13597: Fix the documentation of the "-u" command-line option, and wording of "What's new in Python 3.0" about standard streams.
Antoine Pitrou <solipsis@pitrou.net>
parents: 73320
diff changeset
274 block-buffered if redirected to a non-interactive file.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
275
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
276 See also :envvar:`PYTHONUNBUFFERED`.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
277
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
278
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
279 .. cmdoption:: -v
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
280
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
281 Print a message each time a module is initialized, showing the place
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
282 (filename or built-in module) from which it is loaded. When given twice
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
283 (:option:`-vv`), print a message for each file that is checked for when
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
284 searching for a module. Also provides information on module cleanup at exit.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
285 See also :envvar:`PYTHONVERBOSE`.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
286
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
287
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
288 .. cmdoption:: -W arg
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
289
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
290 Warning control. Python's warning machinery by default prints warning
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
291 messages to :data:`sys.stderr`. A typical warning message has the following
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
292 form::
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
293
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
294 file:line: category: message
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
295
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
296 By default, each warning is printed once for each source line where it
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
297 occurs. This option controls how often warnings are printed.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
298
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
299 Multiple :option:`-W` options may be given; when a warning matches more than
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
300 one option, the action for the last matching option is performed. Invalid
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
301 :option:`-W` options are ignored (though, a warning message is printed about
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
302 invalid options when the first warning is issued).
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
303
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
304 Warnings can also be controlled from within a Python program using the
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
305 :mod:`warnings` module.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
306
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
307 The simplest form of argument is one of the following action strings (or a
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
308 unique abbreviation):
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
309
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
310 ``ignore``
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
311 Ignore all warnings.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
312 ``default``
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
313 Explicitly request the default behavior (printing each warning once per
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
314 source line).
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
315 ``all``
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
316 Print a warning each time it occurs (this may generate many messages if a
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
317 warning is triggered repeatedly for the same source line, such as inside a
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
318 loop).
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
319 ``module``
54841
f6cb2932022c Merged revisions 73544 via svnmerge from
Georg Brandl <georg@python.org>
parents: 53513
diff changeset
320 Print each warning only the first time it occurs in each module.
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
321 ``once``
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
322 Print each warning only the first time it occurs in the program.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
323 ``error``
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
324 Raise an exception instead of printing a warning message.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
325
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
326 The full form of argument is::
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
327
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
328 action:message:category:module:line
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
329
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
330 Here, *action* is as explained above but only applies to messages that match
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
331 the remaining fields. Empty fields match all values; trailing empty fields
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
332 may be omitted. The *message* field matches the start of the warning message
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
333 printed; this match is case-insensitive. The *category* field matches the
60504
a65f91bbc2fb Merged revisions 79307,79408,79430,79533,79542,79579-79580,79585-79587,79607-79608,79622,79717,79820,79822,79828,79862,79875,79923-79924,79941-79943,79945,79947,79951-79952 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 60436
diff changeset
334 warning category. This must be a class name; the match tests whether the
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
335 actual warning category of the message is a subclass of the specified warning
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
336 category. The full class name must be given. The *module* field matches the
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
337 (fully-qualified) module name; this match is case-sensitive. The *line*
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
338 field matches the line number, where zero matches all line numbers and is
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
339 thus equivalent to an omitted line number.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
340
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
341 .. seealso::
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
342 :mod:`warnings` -- the warnings module
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
343
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
344 :pep:`230` -- Warning framework
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
345
60436
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
346 :envvar:`PYTHONWARNINGS`
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
347
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
348
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
349 .. cmdoption:: -x
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
350
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
351 Skip the first line of the source, allowing use of non-Unix forms of
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
352 ``#!cmd``. This is intended for a DOS specific hack only.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
353
53513
d37a4c5d6d2b Merged revisions 72008 via svnmerge from
Georg Brandl <georg@python.org>
parents: 51452
diff changeset
354 .. note:: The line numbers in error messages will be off by one.
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
355
75066
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
356
65575
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
357 .. cmdoption:: -X
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
358
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
359 Reserved for various implementation-specific options. CPython currently
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
360 defines none of them, but allows to pass arbitrary values and retrieve
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
361 them through the :data:`sys._xoptions` dictionary.
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
362
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
363 .. versionchanged:: 3.2
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
364 It is now allowed to pass :option:`-X` with CPython.
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
365
0b5bfba7a907 Issue #10089: Add support for arbitrary -X options on the command-line.
Antoine Pitrou <solipsis@pitrou.net>
parents: 65265
diff changeset
366
58719
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
367 Options you shouldn't use
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
368 ~~~~~~~~~~~~~~~~~~~~~~~~~
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
369
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
370 .. cmdoption:: -J
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
371
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
372 Reserved for use by Jython_.
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
373
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
374 .. _Jython: http://jython.org
979c3b625083 Document the -J and -X options for CPython. Note that unlike for py2k, we
Barry Warsaw <barry@python.org>
parents: 58150
diff changeset
375
75066
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
376
44104
ff1766eb2fce Merged revisions 59259-59274 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44052
diff changeset
377 .. _using-on-envvars:
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
378
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
379 Environment variables
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
380 ---------------------
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
381
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
382 These environment variables influence Python's behavior.
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
383
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
384 .. envvar:: PYTHONHOME
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
385
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
386 Change the location of the standard Python libraries. By default, the
44834
ed33da2e74e7 Merged revisions 60143-60149 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44587
diff changeset
387 libraries are searched in :file:`{prefix}/lib/python{version}` and
ed33da2e74e7 Merged revisions 60143-60149 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44587
diff changeset
388 :file:`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` and
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
389 :file:`{exec_prefix}` are installation-dependent directories, both defaulting
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
390 to :file:`/usr/local`.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
391
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
392 When :envvar:`PYTHONHOME` is set to a single directory, its value replaces
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
393 both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different values
44834
ed33da2e74e7 Merged revisions 60143-60149 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44587
diff changeset
394 for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`.
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
395
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
396
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
397 .. envvar:: PYTHONPATH
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
398
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
399 Augment the default search path for module files. The format is the same as
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
400 the shell's :envvar:`PATH`: one or more directory pathnames separated by
45773
832c820e9d14 Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44834
diff changeset
401 :data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows).
832c820e9d14 Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44834
diff changeset
402 Non-existent directories are silently ignored.
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
403
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
404 In addition to normal directories, individual :envvar:`PYTHONPATH` entries
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
405 may refer to zipfiles containing pure Python modules (in either source or
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
406 compiled form). Extension modules cannot be imported from zipfiles.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
407
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
408 The default search path is installation dependent, but generally begins with
50569
8b2c1a0a9a2b Merged revisions 68247 via svnmerge from
Georg Brandl <georg@python.org>
parents: 50563
diff changeset
409 :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). It
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
410 is *always* appended to :envvar:`PYTHONPATH`.
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
411
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
412 An additional directory will be inserted in the search path in front of
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
413 :envvar:`PYTHONPATH` as described above under
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
414 :ref:`using-on-interface-options`. The search path can be manipulated from
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
415 within a Python program as the variable :data:`sys.path`.
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
416
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
417
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
418 .. envvar:: PYTHONSTARTUP
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
419
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
420 If this is the name of a readable file, the Python commands in that file are
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
421 executed before the first prompt is displayed in interactive mode. The file
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
422 is executed in the same namespace where interactive commands are executed so
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
423 that objects defined or imported in it can be used without qualification in
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
424 the interactive session. You can also change the prompts :data:`sys.ps1` and
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
425 :data:`sys.ps2` in this file.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
426
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
427
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
428 .. envvar:: PYTHONY2K
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
429
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
430 Set this to a non-empty string to cause the :mod:`time` module to require
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
431 dates specified as strings to include 4-digit years, otherwise 2-digit years
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
432 are converted based on rules described in the :mod:`time` module
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
433 documentation.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
434
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
435
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
436 .. envvar:: PYTHONOPTIMIZE
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
437
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
438 If this is set to a non-empty string it is equivalent to specifying the
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
439 :option:`-O` option. If set to an integer, it is equivalent to specifying
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
440 :option:`-O` multiple times.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
441
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
442
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
443 .. envvar:: PYTHONDEBUG
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
444
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
445 If this is set to a non-empty string it is equivalent to specifying the
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
446 :option:`-d` option. If set to an integer, it is equivalent to specifying
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
447 :option:`-d` multiple times.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
448
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
449
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
450 .. envvar:: PYTHONINSPECT
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
451
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
452 If this is set to a non-empty string it is equivalent to specifying the
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
453 :option:`-i` option.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
454
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
455 This variable can also be modified by Python code using :data:`os.environ`
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
456 to force inspect mode on program termination.
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
457
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
458
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
459 .. envvar:: PYTHONUNBUFFERED
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
460
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
461 If this is set to a non-empty string it is equivalent to specifying the
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
462 :option:`-u` option.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
463
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
464
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
465 .. envvar:: PYTHONVERBOSE
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
466
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
467 If this is set to a non-empty string it is equivalent to specifying the
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
468 :option:`-v` option. If set to an integer, it is equivalent to specifying
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
469 :option:`-v` multiple times.
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
470
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
471
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
472 .. envvar:: PYTHONCASEOK
50563
93cf3a6ead63 Merged revisions 68226 via svnmerge from
Georg Brandl <georg@python.org>
parents: 49679
diff changeset
473
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
474 If this is set, Python ignores case in :keyword:`import` statements. This
74635
524795e8abe1 Issue #13883: Document all platforms PYTHONCASEOK works on.
Brett Cannon <brett@python.org>
parents: 74108
diff changeset
475 only works on Windows, OS X, and OS/2.
43740
c00dc7586714 Add new directory "using". This should have been in the merge patch,
Georg Brandl <georg@python.org>
parents:
diff changeset
476
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
477
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
478 .. envvar:: PYTHONDONTWRITEBYTECODE
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
479
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
480 If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the
73320
64ac030fd5d5 State explicitely that PYTHONDONTWRITEBYTECODE is equivalent to -B
Éric Araujo <merwok@netwok.org>
parents: 71779
diff changeset
481 import of source modules. This is equivalent to specifying the :option:`-B`
64ac030fd5d5 State explicitely that PYTHONDONTWRITEBYTECODE is equivalent to -B
Éric Araujo <merwok@netwok.org>
parents: 71779
diff changeset
482 option.
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
483
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
484
75066
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
485 .. envvar:: PYTHONHASHSEED
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
486
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
487 If this variable is set to ``random``, the effect is the same as specifying
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
488 the :option:`-R` option: a random value is used to seed the hashes of str,
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
489 bytes and datetime objects.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
490
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
491 If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a fixed
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
492 seed for generating the hash() of the types covered by the hash
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
493 randomization.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
494
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
495 Its purpose is to allow repeatable hashing, such as for selftests for the
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
496 interpreter itself, or to allow a cluster of python processes to share hash
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
497 values.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
498
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
499 The integer must be a decimal number in the range [0,4294967295]. Specifying
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
500 the value 0 will lead to the same hash values as when hash randomization is
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
501 disabled.
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
502
75073
4a31f6b11e7a Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 74635 75066
diff changeset
503 .. versionadded:: 3.2.3
75066
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
504
f4b7ecf8a5f8 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
Georg Brandl <georg@python.org>
parents: 65113
diff changeset
505
47607
6dd3eb41170a Merged revisions 64130 via svnmerge from
Georg Brandl <georg@python.org>
parents: 47464
diff changeset
506 .. envvar:: PYTHONIOENCODING
6dd3eb41170a Merged revisions 64130 via svnmerge from
Georg Brandl <georg@python.org>
parents: 47464
diff changeset
507
64158
ea0decd2acfb Fix typo
Éric Araujo <merwok@netwok.org>
parents: 64151
diff changeset
508 If this is set before running the interpreter, it overrides the encoding used
64151
687cc854cb4b Issue #8622: Add PYTHONFSENCODING environment variable to override the
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64112
diff changeset
509 for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. The
687cc854cb4b Issue #8622: Add PYTHONFSENCODING environment variable to override the
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64112
diff changeset
510 ``:errorhandler`` part is optional and has the same meaning as in
687cc854cb4b Issue #8622: Add PYTHONFSENCODING environment variable to override the
Victor Stinner <victor.stinner@haypocalc.com>
parents: 64112
diff changeset
511 :func:`str.encode`.
47607
6dd3eb41170a Merged revisions 64130 via svnmerge from
Georg Brandl <georg@python.org>
parents: 47464
diff changeset
512
47611
da47e7e135ae #2630: Implement PEP 3138.
Georg Brandl <georg@python.org>
parents: 47607
diff changeset
513 For stderr, the ``:errorhandler`` part is ignored; the handler will always be
da47e7e135ae #2630: Implement PEP 3138.
Georg Brandl <georg@python.org>
parents: 47607
diff changeset
514 ``'backslashreplace'``.
da47e7e135ae #2630: Implement PEP 3138.
Georg Brandl <georg@python.org>
parents: 47607
diff changeset
515
47607
6dd3eb41170a Merged revisions 64130 via svnmerge from
Georg Brandl <georg@python.org>
parents: 47464
diff changeset
516
46708
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
517 .. envvar:: PYTHONNOUSERSITE
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
518
71778
74179a79d673 Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents: 70729
diff changeset
519 If this is set, Python won't add the :data:`user site-packages directory
74179a79d673 Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents: 70729
diff changeset
520 <site.USER_SITE>` to :data:`sys.path`.
46708
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
521
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
522 .. seealso::
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
523
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
524 :pep:`370` -- Per user site-packages directory
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
525
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
526
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
527 .. envvar:: PYTHONUSERBASE
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
528
71778
74179a79d673 Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents: 70729
diff changeset
529 Defines the :data:`user base directory <site.USER_BASE>`, which is used to
74179a79d673 Improve documentation for PEP 370 support in site module (#8617).
Éric Araujo <merwok@netwok.org>
parents: 70729
diff changeset
530 compute the path of the :data:`user site-packages directory <site.USER_SITE>`
71779
1b0b5f644090 Add documentation for PEP 370 features in distutils (#10745).
Éric Araujo <merwok@netwok.org>
parents: 71778
diff changeset
531 and :ref:`Distutils installation paths <inst-alt-install-user>` for ``python
1b0b5f644090 Add documentation for PEP 370 features in distutils (#10745).
Éric Araujo <merwok@netwok.org>
parents: 71778
diff changeset
532 setup.py install --user``.
46708
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
533
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
534 .. seealso::
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
535
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
536 :pep:`370` -- Per user site-packages directory
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
537
74b9c85361f8 Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 46664
diff changeset
538
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
539 .. envvar:: PYTHONEXECUTABLE
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
540
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
541 If this environment variable is set, ``sys.argv[0]`` will be set to its
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
542 value instead of the value got through the C runtime. Only works on
49186
47db62bf6aa7 Merged revisions 66452 via svnmerge from
Georg Brandl <georg@python.org>
parents: 47611
diff changeset
543 Mac OS X.
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
544
60436
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
545 .. envvar:: PYTHONWARNINGS
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
546
60504
a65f91bbc2fb Merged revisions 79307,79408,79430,79533,79542,79579-79580,79585-79587,79607-79608,79622,79717,79820,79822,79828,79862,79875,79923-79924,79941-79943,79945,79947,79951-79952 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 60436
diff changeset
547 This is equivalent to the :option:`-W` option. If set to a comma
60436
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
548 separated string, it is equivalent to specifying :option:`-W` multiple
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
549 times.
f369db0d5845 Merged revisions 79878-79880 via svnmerge from
Philip Jenvey <pjenvey@underboss.org>
parents: 60149
diff changeset
550
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
551
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
552 Debug-mode variables
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
553 ~~~~~~~~~~~~~~~~~~~~
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
554
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
555 Setting these variables only has an effect in a debug build of Python, that is,
70729
59d785ea0039 Fix a few misuses of :option: I missed in r86521.
Éric Araujo <merwok@netwok.org>
parents: 68257
diff changeset
556 if Python was configured with the ``--with-pydebug`` build option.
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
557
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
558 .. envvar:: PYTHONTHREADDEBUG
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
559
46664
031dfe455585 Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45773
diff changeset
560 If set, Python will print threading debug info.
44587
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
561
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
562
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
563 .. envvar:: PYTHONDUMPREFS
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
564
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
565 If set, Python will dump objects and reference counts still alive after
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
566 shutting down the interpreter.
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
567
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
568
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
569 .. envvar:: PYTHONMALLOCSTATS
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
570
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
571 If set, Python will print memory allocation statistics every time a new
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
572 object arena is created, and on shutdown.
fb5a6330f71b Merged revisions 59822-59841 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 44213
diff changeset
573