| Benjamin Peterson | b9869df | 2016-03-21 22:31:02 -0700 | [diff] [blame] | 1 | .TH PYTHON "1" | 
| Andrew M. Kuchling | 3afe4f3 | 2004-10-07 12:30:54 +0000 | [diff] [blame] | 2 |  | 
| Benjamin Peterson | 5f28b7b | 2009-03-26 21:49:58 +0000 | [diff] [blame] | 3 | .\" To view this file while editing, run it through groff: | 
 | 4 | .\"   groff -Tascii -man python.man | less | 
| Andrew M. Kuchling | 3afe4f3 | 2004-10-07 12:30:54 +0000 | [diff] [blame] | 5 |  | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 6 | .SH NAME | 
 | 7 | python \- an interpreted, interactive, object-oriented programming language | 
 | 8 | .SH SYNOPSIS | 
 | 9 | .B python | 
 | 10 | [ | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 11 | .B \-B | 
 | 12 | ] | 
 | 13 | [ | 
| Senthil Kumaran | ce3dd0b | 2013-06-19 22:19:46 -0500 | [diff] [blame] | 14 | .B \-b | 
 | 15 | ] | 
 | 16 | [ | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 17 | .B \-d | 
 | 18 | ] | 
 | 19 | [ | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 20 | .B \-E | 
 | 21 | ] | 
 | 22 | [ | 
 | 23 | .B \-h | 
 | 24 | ] | 
 | 25 | [ | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 26 | .B \-i | 
 | 27 | ] | 
 | 28 | [ | 
| Christian Heimes | ad73a9c | 2013-08-10 16:36:18 +0200 | [diff] [blame] | 29 | .B \-I | 
| Andrew M. Kuchling | 166e625 | 2004-10-07 12:04:50 +0000 | [diff] [blame] | 30 | ] | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 31 | .br | 
 | 32 |        [ | 
| Christian Heimes | ad73a9c | 2013-08-10 16:36:18 +0200 | [diff] [blame] | 33 | .B \-m | 
 | 34 | .I module-name | 
 | 35 | ] | 
 | 36 | [ | 
| Senthil Kumaran | ce3dd0b | 2013-06-19 22:19:46 -0500 | [diff] [blame] | 37 | .B \-q | 
 | 38 | ] | 
 | 39 | [ | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 40 | .B \-O | 
 | 41 | ] | 
 | 42 | [ | 
| R David Murray | 9c4f09d | 2011-05-01 11:13:56 -0400 | [diff] [blame] | 43 | .B \-OO | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 44 | ] | 
 | 45 | [ | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 46 | .B \-s | 
 | 47 | ] | 
 | 48 | [ | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 49 | .B \-S | 
| Neil Schemenauer | 7d4bb9f | 2001-07-23 16:30:27 +0000 | [diff] [blame] | 50 | ] | 
 | 51 | [ | 
| Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 52 | .B \-u | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 53 | ] | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 54 | .br | 
 | 55 |        [ | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 56 | .B \-v | 
 | 57 | ] | 
| Guido van Rossum | 07c44c7 | 1998-04-10 19:46:00 +0000 | [diff] [blame] | 58 | [ | 
| Barry Warsaw | 6456937 | 2000-09-15 18:39:09 +0000 | [diff] [blame] | 59 | .B \-V | 
 | 60 | ] | 
| Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 61 | [ | 
 | 62 | .B \-W | 
 | 63 | .I argument | 
 | 64 | ] | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 65 | [ | 
 | 66 | .B \-x | 
 | 67 | ] | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 68 | [ | 
| Senthil Kumaran | ce3dd0b | 2013-06-19 22:19:46 -0500 | [diff] [blame] | 69 | [ | 
 | 70 | .B \-X | 
 | 71 | .I option | 
 | 72 | ] | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 73 | .B \-? | 
 | 74 | ] | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 75 | .br | 
 | 76 |        [ | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 77 | .B \-c | 
 | 78 | .I command | 
 | 79 | | | 
 | 80 | .I script | 
 | 81 | | | 
 | 82 | \- | 
 | 83 | ] | 
 | 84 | [ | 
 | 85 | .I arguments | 
 | 86 | ] | 
 | 87 | .SH DESCRIPTION | 
 | 88 | Python is an interpreted, interactive, object-oriented programming | 
 | 89 | language that combines remarkable power with very clear syntax. | 
| Benjamin Peterson | b0335ee | 2015-04-29 18:00:44 -0400 | [diff] [blame] | 90 | For an introduction to programming in Python, see the Python Tutorial. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 91 | The Python Library Reference documents built-in and standard types, | 
 | 92 | constants, functions and modules. | 
 | 93 | Finally, the Python Reference Manual describes the syntax and | 
 | 94 | semantics of the core language in (perhaps too) much detail. | 
| Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 95 | (These documents may be located via the | 
 | 96 | .B "INTERNET RESOURCES" | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 97 | below; they may be installed on your system as well.) | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 98 | .PP | 
 | 99 | Python's basic power can be extended with your own modules written in | 
 | 100 | C or C++. | 
| Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 101 | On most systems such modules may be dynamically loaded. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 102 | Python is also adaptable as an extension language for existing | 
 | 103 | applications. | 
 | 104 | See the internal documentation for hints. | 
| Andrew M. Kuchling | 88717f4 | 2001-04-05 14:50:40 +0000 | [diff] [blame] | 105 | .PP | 
| Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 106 | Documentation for installed Python modules and packages can be | 
 | 107 | viewed by running the | 
| Andrew M. Kuchling | 88717f4 | 2001-04-05 14:50:40 +0000 | [diff] [blame] | 108 | .B pydoc | 
| Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 109 | program. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 110 | .SH COMMAND LINE OPTIONS | 
 | 111 | .TP | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 112 | .B \-B | 
 | 113 | Don't write | 
 | 114 | .I .py[co] | 
 | 115 | files on import. See also PYTHONDONTWRITEBYTECODE. | 
 | 116 | .TP | 
| Senthil Kumaran | ce3dd0b | 2013-06-19 22:19:46 -0500 | [diff] [blame] | 117 | .B \-b | 
 | 118 | Issue warnings about str(bytes_instance), str(bytearray_instance) | 
 | 119 | and comparing bytes/bytearray with str. (-bb: issue errors) | 
 | 120 | .TP | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 121 | .BI "\-c " command | 
 | 122 | Specify the command to execute (see next section). | 
 | 123 | This terminates the option list (following options are passed as | 
 | 124 | arguments to the command). | 
 | 125 | .TP | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 126 | .B \-d | 
 | 127 | Turn on parser debugging output (for wizards only, depending on | 
 | 128 | compilation options). | 
| Guido van Rossum | 9f65ae0 | 1994-02-23 09:10:27 +0000 | [diff] [blame] | 129 | .TP | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 130 | .B \-E | 
 | 131 | Ignore environment variables like PYTHONPATH and PYTHONHOME that modify | 
 | 132 | the behavior of the interpreter. | 
 | 133 | .TP | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 134 | .B \-h ", " \-? ", "\-\-help | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 135 | Prints the usage for the interpreter executable and exits. | 
 | 136 | .TP | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 137 | .B \-i | 
 | 138 | When a script is passed as first argument or the \fB\-c\fP option is | 
 | 139 | used, enter interactive mode after executing the script or the | 
| Guido van Rossum | 9f65ae0 | 1994-02-23 09:10:27 +0000 | [diff] [blame] | 140 | command.  It does not read the $PYTHONSTARTUP file.  This can be | 
 | 141 | useful to inspect global variables or a stack trace when a script | 
 | 142 | raises an exception. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 143 | .TP | 
| Christian Heimes | ad73a9c | 2013-08-10 16:36:18 +0200 | [diff] [blame] | 144 | .B \-I | 
| Ned Deily | 64298ae | 2015-04-29 14:51:43 -0700 | [diff] [blame] | 145 | Run Python in isolated mode. This also implies \fB\-E\fP and \fB\-s\fP. In | 
| Serhiy Storchaka | 225821c | 2015-12-18 13:05:04 +0200 | [diff] [blame] | 146 | isolated mode sys.path contains neither the script's directory nor the user's | 
| Christian Heimes | ad73a9c | 2013-08-10 16:36:18 +0200 | [diff] [blame] | 147 | site-packages directory. All PYTHON* environment variables are ignored, too. | 
 | 148 | Further restrictions may be imposed to prevent the user from injecting | 
 | 149 | malicious code. | 
 | 150 | .TP | 
| Andrew M. Kuchling | 166e625 | 2004-10-07 12:04:50 +0000 | [diff] [blame] | 151 | .BI "\-m " module-name | 
| Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 152 | Searches | 
 | 153 | .I sys.path | 
 | 154 | for the named module and runs the corresponding | 
 | 155 | .I .py | 
| Andrew M. Kuchling | 166e625 | 2004-10-07 12:04:50 +0000 | [diff] [blame] | 156 | file as a script. | 
 | 157 | .TP | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 158 | .B \-O | 
| Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 159 | Turn on basic optimizations.  Given twice, causes docstrings to be discarded. | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 160 | .TP | 
| R David Murray | 9c4f09d | 2011-05-01 11:13:56 -0400 | [diff] [blame] | 161 | .B \-OO | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 162 | Discard docstrings in addition to the \fB-O\fP optimizations. | 
 | 163 | .TP | 
| Georg Brandl | 9d87119 | 2010-12-04 10:47:18 +0000 | [diff] [blame] | 164 | .B \-q | 
| Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 165 | Do not print the version and copyright messages. These messages are | 
| Georg Brandl | 9d87119 | 2010-12-04 10:47:18 +0000 | [diff] [blame] | 166 | also suppressed in non-interactive mode. | 
 | 167 | .TP | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 168 | .B \-s | 
 | 169 | Don't add user site directory to sys.path. | 
 | 170 | .TP | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 171 | .B \-S | 
 | 172 | Disable the import of the module | 
 | 173 | .I site | 
 | 174 | and the site-dependent manipulations of | 
 | 175 | .I sys.path | 
| Éric Araujo | c09fca6 | 2011-03-23 02:06:24 +0100 | [diff] [blame] | 176 | that it entails.  Also disable these manipulations if | 
 | 177 | .I site | 
 | 178 | is explicitly imported later. | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 179 | .TP | 
| Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 180 | .B \-u | 
| Ezio Melotti | 61b0c67 | 2013-07-25 05:04:02 +0200 | [diff] [blame] | 181 | Force the binary I/O layers of stdout and stderr to be unbuffered. | 
 | 182 | stdin is always buffered. | 
| Georg Brandl | 379299c | 2010-04-02 08:47:07 +0000 | [diff] [blame] | 183 | The text I/O layer will still be line-buffered. | 
 | 184 | .\" Note that there is internal buffering in readlines() and | 
 | 185 | .\" file-object iterators ("for line in sys.stdin") which is not | 
 | 186 | .\" influenced by this option.  To work around this, you will want to use | 
 | 187 | .\" "sys.stdin.readline()" inside a "while 1:" loop. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 188 | .TP | 
 | 189 | .B \-v | 
 | 190 | Print a message each time a module is initialized, showing the place | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 191 | (filename or built-in module) from which it is loaded.  When given | 
| Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 192 | twice, print a message for each file that is checked for when | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 193 | searching for a module.  Also provides information on module cleanup | 
 | 194 | at exit. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 195 | .TP | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 196 | .B \-V ", " \-\-version | 
| Barry Warsaw | 6456937 | 2000-09-15 18:39:09 +0000 | [diff] [blame] | 197 | Prints the Python version number of the executable and exits. | 
 | 198 | .TP | 
| Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 199 | .BI "\-W " argument | 
 | 200 | Warning control.  Python sometimes prints warning message to | 
 | 201 | .IR sys.stderr . | 
 | 202 | A typical warning message has the following form: | 
 | 203 | .IB file ":" line ": " category ": " message. | 
 | 204 | By default, each warning is printed once for each source line where it | 
 | 205 | occurs.  This option controls how often warnings are printed. | 
 | 206 | Multiple | 
 | 207 | .B \-W | 
 | 208 | options may be given; when a warning matches more than one | 
 | 209 | option, the action for the last matching option is performed. | 
 | 210 | Invalid | 
 | 211 | .B \-W | 
 | 212 | options are ignored (a warning message is printed about invalid | 
 | 213 | options when the first warning is issued).  Warnings can also be | 
 | 214 | controlled from within a Python program using the | 
 | 215 | .I warnings | 
 | 216 | module. | 
 | 217 |  | 
 | 218 | The simplest form of | 
 | 219 | .I argument | 
 | 220 | is one of the following | 
 | 221 | .I action | 
 | 222 | strings (or a unique abbreviation): | 
 | 223 | .B ignore | 
 | 224 | to ignore all warnings; | 
 | 225 | .B default | 
 | 226 | to explicitly request the default behavior (printing each warning once | 
 | 227 | per source line); | 
 | 228 | .B all | 
 | 229 | to print a warning each time it occurs (this may generate many | 
 | 230 | messages if a warning is triggered repeatedly for the same source | 
| Fred Drake | bd2e3b0 | 2001-07-26 21:25:58 +0000 | [diff] [blame] | 231 | line, such as inside a loop); | 
| Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 232 | .B module | 
| Georg Brandl | eeb575f | 2009-06-24 06:42:05 +0000 | [diff] [blame] | 233 | to print each warning only the first time it occurs in each | 
| Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 234 | module; | 
 | 235 | .B once | 
 | 236 | to print each warning only the first time it occurs in the program; or | 
 | 237 | .B error | 
 | 238 | to raise an exception instead of printing a warning message. | 
 | 239 |  | 
 | 240 | The full form of | 
 | 241 | .I argument | 
 | 242 | is | 
 | 243 | .IB action : message : category : module : line. | 
 | 244 | Here, | 
 | 245 | .I action | 
 | 246 | is as explained above but only applies to messages that match the | 
 | 247 | remaining fields.  Empty fields match all values; trailing empty | 
 | 248 | fields may be omitted.  The | 
 | 249 | .I message | 
 | 250 | field matches the start of the warning message printed; this match is | 
 | 251 | case-insensitive.  The | 
 | 252 | .I category | 
 | 253 | field matches the warning category.  This must be a class name; the | 
 | 254 | match test whether the actual warning category of the message is a | 
 | 255 | subclass of the specified warning category.  The full class name must | 
 | 256 | be given.  The | 
 | 257 | .I module | 
 | 258 | field matches the (fully-qualified) module name; this match is | 
 | 259 | case-sensitive.  The | 
 | 260 | .I line | 
 | 261 | field matches the line number, where zero matches all line numbers and | 
 | 262 | is thus equivalent to an omitted line number. | 
 | 263 | .TP | 
| Senthil Kumaran | ce3dd0b | 2013-06-19 22:19:46 -0500 | [diff] [blame] | 264 | .BI "\-X " option | 
 | 265 | Set implementation specific option. | 
 | 266 | .TP | 
| Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 267 | .B \-x | 
 | 268 | Skip the first line of the source.  This is intended for a DOS | 
 | 269 | specific hack only.  Warning: the line numbers in error messages will | 
 | 270 | be off by one! | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 271 | .SH INTERPRETER INTERFACE | 
 | 272 | The interpreter interface resembles that of the UNIX shell: when | 
 | 273 | called with standard input connected to a tty device, it prompts for | 
 | 274 | commands and executes them until an EOF is read; when called with a | 
 | 275 | file name argument or with a file as standard input, it reads and | 
 | 276 | executes a | 
 | 277 | .I script | 
 | 278 | from that file; | 
 | 279 | when called with | 
 | 280 | .B \-c | 
| doko@ubuntu.com | d8623e8 | 2012-06-20 13:16:31 +0200 | [diff] [blame] | 281 | .IR command , | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 282 | it executes the Python statement(s) given as | 
| doko@ubuntu.com | d8623e8 | 2012-06-20 13:16:31 +0200 | [diff] [blame] | 283 | .IR command . | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 284 | Here | 
 | 285 | .I command | 
 | 286 | may contain multiple statements separated by newlines. | 
 | 287 | Leading whitespace is significant in Python statements! | 
| Matthias Klose | 31a58df | 2005-03-20 14:16:03 +0000 | [diff] [blame] | 288 | In non-interactive mode, the entire input is parsed before it is | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 289 | executed. | 
 | 290 | .PP | 
 | 291 | If available, the script name and additional arguments thereafter are | 
 | 292 | passed to the script in the Python variable | 
| doko@ubuntu.com | d8623e8 | 2012-06-20 13:16:31 +0200 | [diff] [blame] | 293 | .IR sys.argv , | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 294 | which is a list of strings (you must first | 
 | 295 | .I import sys | 
 | 296 | to be able to access it). | 
 | 297 | If no script name is given, | 
| Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 298 | .I sys.argv[0] | 
 | 299 | is an empty string; if | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 300 | .B \-c | 
 | 301 | is used, | 
 | 302 | .I sys.argv[0] | 
 | 303 | contains the string | 
 | 304 | .I '-c'. | 
| Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 305 | Note that options interpreted by the Python interpreter itself | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 306 | are not placed in | 
| doko@ubuntu.com | d8623e8 | 2012-06-20 13:16:31 +0200 | [diff] [blame] | 307 | .IR sys.argv . | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 308 | .PP | 
 | 309 | In interactive mode, the primary prompt is `>>>'; the second prompt | 
 | 310 | (which appears when a command is not complete) is `...'. | 
 | 311 | The prompts can be changed by assignment to | 
 | 312 | .I sys.ps1 | 
 | 313 | or | 
| doko@ubuntu.com | d8623e8 | 2012-06-20 13:16:31 +0200 | [diff] [blame] | 314 | .IR sys.ps2 . | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 315 | The interpreter quits when it reads an EOF at a prompt. | 
 | 316 | When an unhandled exception occurs, a stack trace is printed and | 
 | 317 | control returns to the primary prompt; in non-interactive mode, the | 
 | 318 | interpreter exits after printing the stack trace. | 
 | 319 | The interrupt signal raises the | 
 | 320 | .I Keyboard\%Interrupt | 
 | 321 | exception; other UNIX signals are not caught (except that SIGPIPE is | 
 | 322 | sometimes ignored, in favor of the | 
 | 323 | .I IOError | 
 | 324 | exception).  Error messages are written to stderr. | 
 | 325 | .SH FILES AND DIRECTORIES | 
 | 326 | These are subject to difference depending on local installation | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 327 | conventions; ${prefix} and ${exec_prefix} are installation-dependent | 
 | 328 | and should be interpreted as for GNU software; they may be the same. | 
 | 329 | The default for both is \fI/usr/local\fP. | 
 | 330 | .IP \fI${exec_prefix}/bin/python\fP | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 331 | Recommended location of the interpreter. | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 332 | .PP | 
 | 333 | .I ${prefix}/lib/python<version> | 
 | 334 | .br | 
 | 335 | .I ${exec_prefix}/lib/python<version> | 
 | 336 | .RS | 
 | 337 | Recommended locations of the directories containing the standard | 
 | 338 | modules. | 
 | 339 | .RE | 
 | 340 | .PP | 
 | 341 | .I ${prefix}/include/python<version> | 
 | 342 | .br | 
 | 343 | .I ${exec_prefix}/include/python<version> | 
 | 344 | .RS | 
 | 345 | Recommended locations of the directories containing the include files | 
 | 346 | needed for developing Python extensions and embedding the | 
 | 347 | interpreter. | 
 | 348 | .RE | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 349 | .SH ENVIRONMENT VARIABLES | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 350 | .IP PYTHONHOME | 
 | 351 | Change the location of the standard Python libraries.  By default, the | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 352 | libraries are searched in ${prefix}/lib/python<version> and | 
 | 353 | ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix} | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 354 | are installation-dependent directories, both defaulting to | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 355 | \fI/usr/local\fP.  When $PYTHONHOME is set to a single directory, its value | 
 | 356 | replaces both ${prefix} and ${exec_prefix}.  To specify different values | 
 | 357 | for these, set $PYTHONHOME to ${prefix}:${exec_prefix}. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 358 | .IP PYTHONPATH | 
 | 359 | Augments the default search path for module files. | 
 | 360 | The format is the same as the shell's $PATH: one or more directory | 
 | 361 | pathnames separated by colons. | 
| Matthias Klose | 31a58df | 2005-03-20 14:16:03 +0000 | [diff] [blame] | 362 | Non-existent directories are silently ignored. | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 363 | The default search path is installation dependent, but generally | 
| Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 364 | begins with ${prefix}/lib/python<version> (see PYTHONHOME above). | 
| Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 365 | The default search path is always appended to $PYTHONPATH. | 
| Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 366 | If a script argument is given, the directory containing the script is | 
 | 367 | inserted in the path in front of $PYTHONPATH. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 368 | The search path can be manipulated from within a Python program as the | 
 | 369 | variable | 
| doko@ubuntu.com | d8623e8 | 2012-06-20 13:16:31 +0200 | [diff] [blame] | 370 | .IR sys.path . | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 371 | .IP PYTHONSTARTUP | 
 | 372 | If this is the name of a readable file, the Python commands in that | 
 | 373 | file are executed before the first prompt is displayed in interactive | 
 | 374 | mode. | 
 | 375 | The file is executed in the same name space where interactive commands | 
 | 376 | are executed so that objects defined or imported in it can be used | 
 | 377 | without qualification in the interactive session. | 
 | 378 | You can also change the prompts | 
 | 379 | .I sys.ps1 | 
 | 380 | and | 
 | 381 | .I sys.ps2 | 
 | 382 | in this file. | 
| Guido van Rossum | 9abaf4d | 2001-10-12 22:17:56 +0000 | [diff] [blame] | 383 | .IP PYTHONOPTIMIZE | 
 | 384 | If this is set to a non-empty string it is equivalent to specifying | 
 | 385 | the \fB\-O\fP option. If set to an integer, it is equivalent to | 
 | 386 | specifying \fB\-O\fP multiple times. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 387 | .IP PYTHONDEBUG | 
 | 388 | If this is set to a non-empty string it is equivalent to specifying | 
| Guido van Rossum | 9abaf4d | 2001-10-12 22:17:56 +0000 | [diff] [blame] | 389 | the \fB\-d\fP option. If set to an integer, it is equivalent to | 
 | 390 | specifying \fB\-d\fP multiple times. | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 391 | .IP PYTHONDONTWRITEBYTECODE | 
 | 392 | If this is set to a non-empty string it is equivalent to specifying | 
 | 393 | the \fB\-B\fP option (don't try to write | 
 | 394 | .I .py[co] | 
 | 395 | files). | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 396 | .IP PYTHONINSPECT | 
 | 397 | If this is set to a non-empty string it is equivalent to specifying | 
 | 398 | the \fB\-i\fP option. | 
| Benjamin Peterson | ee85a1d | 2010-10-13 22:20:15 +0000 | [diff] [blame] | 399 | .IP PYTHONIOENCODING | 
 | 400 | If this is set before running the interpreter, it overrides the encoding used | 
 | 401 | for stdin/stdout/stderr, in the syntax | 
 | 402 | .IB encodingname ":" errorhandler | 
 | 403 | The | 
 | 404 | .IB errorhandler | 
 | 405 | part is optional and has the same meaning as in str.encode. For stderr, the | 
 | 406 | .IB errorhandler | 
 | 407 |  part is ignored; the handler will always be \'backslashreplace\'. | 
| Matthias Klose | c8b16f8 | 2010-01-31 16:14:37 +0000 | [diff] [blame] | 408 | .IP PYTHONNOUSERSITE | 
| Benjamin Peterson | ee85a1d | 2010-10-13 22:20:15 +0000 | [diff] [blame] | 409 | If this is set to a non-empty string it is equivalent to specifying the | 
 | 410 | \fB\-s\fP option (Don't add the user site directory to sys.path). | 
| Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 411 | .IP PYTHONUNBUFFERED | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 412 | If this is set to a non-empty string it is equivalent to specifying | 
| Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 413 | the \fB\-u\fP option. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 414 | .IP PYTHONVERBOSE | 
 | 415 | If this is set to a non-empty string it is equivalent to specifying | 
| Guido van Rossum | 9abaf4d | 2001-10-12 22:17:56 +0000 | [diff] [blame] | 416 | the \fB\-v\fP option. If set to an integer, it is equivalent to | 
| Brett Cannon | f299abd | 2015-04-13 14:21:02 -0400 | [diff] [blame] | 417 | specifying \fB\-v\fP multiple times. | 
| Philip Jenvey | 0805ca3 | 2010-04-07 04:04:10 +0000 | [diff] [blame] | 418 | .IP PYTHONWARNINGS | 
 | 419 | If this is set to a comma-separated string it is equivalent to | 
 | 420 | specifying the \fB\-W\fP option for each separate value. | 
| Georg Brandl | 2daf6ae | 2012-02-20 19:54:16 +0100 | [diff] [blame] | 421 | .IP PYTHONHASHSEED | 
| Benjamin Peterson | c9f54cf | 2012-02-21 16:08:05 -0500 | [diff] [blame] | 422 | If this variable is set to "random", a random value is used to seed the hashes | 
 | 423 | of str, bytes and datetime objects. | 
| Georg Brandl | 2daf6ae | 2012-02-20 19:54:16 +0100 | [diff] [blame] | 424 |  | 
 | 425 | If PYTHONHASHSEED is set to an integer value, it is used as a fixed seed for | 
 | 426 | generating the hash() of the types covered by the hash randomization.  Its | 
 | 427 | purpose is to allow repeatable hashing, such as for selftests for the | 
 | 428 | interpreter itself, or to allow a cluster of python processes to share hash | 
 | 429 | values. | 
 | 430 |  | 
 | 431 | The integer must be a decimal number in the range [0,4294967295].  Specifying | 
| Benjamin Peterson | c9f54cf | 2012-02-21 16:08:05 -0500 | [diff] [blame] | 432 | the value 0 will disable hash randomization. | 
| Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 433 | .SH AUTHOR | 
| Benjamin Peterson | 37c4f78 | 2015-05-10 21:19:18 -0400 | [diff] [blame] | 434 | The Python Software Foundation: https://www.python.org/psf/ | 
| Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 435 | .SH INTERNET RESOURCES | 
| Benjamin Peterson | 755640b | 2015-04-30 17:37:11 -0400 | [diff] [blame] | 436 | Main website:  https://www.python.org/ | 
| Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 437 | .br | 
| Benjamin Peterson | 755640b | 2015-04-30 17:37:11 -0400 | [diff] [blame] | 438 | Documentation:  https://docs.python.org/ | 
| Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 439 | .br | 
| Benjamin Peterson | 755640b | 2015-04-30 17:37:11 -0400 | [diff] [blame] | 440 | Developer resources:  https://docs.python.org/devguide/ | 
| Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 441 | .br | 
| Benjamin Peterson | 755640b | 2015-04-30 17:37:11 -0400 | [diff] [blame] | 442 | Downloads:  https://www.python.org/downloads/ | 
| Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 443 | .br | 
| Benjamin Peterson | 755640b | 2015-04-30 17:37:11 -0400 | [diff] [blame] | 444 | Module repository:  https://pypi.python.org/ | 
| Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 445 | .br | 
| Fred Drake | bd2e3b0 | 2001-07-26 21:25:58 +0000 | [diff] [blame] | 446 | Newsgroups:  comp.lang.python, comp.lang.python.announce | 
| Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 447 | .SH LICENSING | 
 | 448 | Python is distributed under an Open Source license.  See the file | 
 | 449 | "LICENSE" in the Python source distribution for information on terms & | 
 | 450 | conditions for accessing and otherwise using Python and for a | 
 | 451 | DISCLAIMER OF ALL WARRANTIES. |