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