File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -302,16 +302,22 @@ Miscellaneous options
302302
303303.. option :: -i
304304
305- Enter interactive mode after execution.
305+ Enter interactive mode after execution, or force interactive mode even when
306+ :data: `sys.stdin ` does not appear to be a terminal.
306307
307308 Using the :option: `-i ` option will enter interactive mode in any of the following circumstances\:
308309
309310 * When a script is passed as first argument
310311 * When the :option: `-c ` option is used
311312 * When the :option: `-m ` option is used
312313
313- Interactive mode will start even when :data: `sys.stdin ` does not appear to be a terminal. The
314- :envvar: `PYTHONSTARTUP ` file is not read.
314+ In these "execute then interact" cases, Python runs the script or command
315+ first and does not read the :envvar: `PYTHONSTARTUP ` file before entering
316+ interactive mode.
317+
318+ When :option: `-i ` is used only to force interactive mode despite redirected
319+ standard input (for example, ``python -i < /dev/null ``), the interpreter
320+ enters interactive mode directly and reads :envvar: `PYTHONSTARTUP ` as usual.
315321
316322 This can be useful to inspect global variables or a stack trace when a script
317323 raises an exception. See also :envvar: `PYTHONINSPECT `.
You can’t perform that action at this time.
0 commit comments