Debug Process I/O
For a debug process launched from Wing, I/O associated with print(), writing to stdout or stderr, calls to input(), or reads from stdin, normally occurs in the Debug I/O tool.
By default, the tool connects to the debug process through pipes. Pipes are simple and fast, but the debug process sees isatty() return False and cannot use features that require a real terminal -- ANSI colors, cursor control, curses, getpass, terminal signals, raw input mode, and so on.
For code that needs those features, enable Use Pseudo-Terminal in the Debug I/O tool's Options menu. This runs the debug process under a real pseudo-terminal connected to a built-in terminal emulator inside the Debug I/O tool, so most terminal-aware code works without leaving the IDE.
If the in-IDE terminal is not sufficient (for example, if you need a fully-featured native console window, or want to keep the program window open after Wing exits), you can fall back to running the debug process in a separate OS terminal window as described in External I/O Consoles.
Debug processes launched outside of Wing, using wingdbstub, always do I/O through the environment from which they were launched, whether that's a console window, web server, or any other I/O environment.
The code that services debug process I/O does two things: (1) any waits on sys.stdin are multiplexed with servicing of the debug network socket, so that the debug process remains responsive to Wing even while waiting for keyboard input, and (2) if the debug process was launched from Wing, I/O is redirected over the network to the IDE.
Multiplexing I/O can cause problems in some code. See Debug Process I/O Multiplexing for details.
If multiple debug processes are active, Wing creates one output buffer for each process launched from the IDE and the process selected in the top left of the tool may be used to move between them.
When commands are typed in the Debug Console in Wing Pro, I/O is redirected temporarily to the Debug Console only during the time that the command is being processed.
Options
The following options are available in the Options menu in the Debug I/O tool:
Clear clears the contents of the current output buffer.
Close All Terminated unconditionally closes all output buffers for debug processes that have been terminated.
Wrap Lines causes long lines to be wrapped in the display.
Never Auto-Show prevents Wing from ever automatically showing the Debug I/O tool.
Always Auto-Show on Output causes Wing to automatically show the Debug I/O tool when any output is received from the debug process.
Auto-Show on First Output causes Wing to automatically show the Debug I/O tool only the first time output is received from a debug process.
Auto-Focus for Input causes Wing to show the Debug I/O tool and set focus into the I/O buffer whenever a debug process is waiting for keyboard input. This is disabled by default in Wing and disabling the Debugger > Advanced > Use sys.stdin Wrapper preference prevents this feature from working.
Retain History causes Wing to retain old output buffers, up to the number configured with the Files > Max Recent Items preference. When this is unchecked, only one buffer is retained. Old buffers are cleared automatically only when a new debug process is started, to avoid losing output for a related group of partially-running processes. Old buffers can be cleared unconditionally at any time with Close All Terminated from the Debug I/O tool's Options menu.
Show Child Processes enables including child processes in the process selector. Otherwise only the top-level parent processes are shown.
Use Pseudo-Terminal runs the debug process under a real pseudo-terminal (PTY) attached to a built-in terminal emulator in the Debug I/O tool, instead of through pipes. When enabled, the debug process sees isatty() == True and ANSI colors, cursor control, curses, getpass, terminal signals, and raw input mode all work. Only takes effect for locally launched debug processes; remote and attached processes continue to use the pipe-based mode. Has no effect when Use External Console is on. Try this first for code that needs terminal features; only fall back to Configure External Console below if the in-IDE terminal is not sufficient.
Configure External Console allows replacing Wing's builtin Debug I/O tool with an OS-appropriate console run in a separate window. See External I/O Consoles for details.
Configure Encoding allows setting the encoding used for I/O to debug processes. This must be set to match the expectation of the debug process.
Show Debug I/O Documentation displays this documentation page.
Section Contents