At the most obvious level, the PythonWin interactive window simulates the built-in Python interpreter in interactive mode. Almost anything you type in the standard Python shell can be used in PythonWin.
To reexecute blocks of code you previously executed, scroll the cursor to the old block and press Enter. The block is copied to the end of the interactive window, allowing you to make any changes before finally reexecuting the code. Alternatively, the Ctrl-Up and Ctrl-Down keys allow you to scroll through the previously executed commands.
PythonWin can also help you locate the source of errors in standard Python tracebacks. All Python tracebacks are printed to the interactive window, and you can double-click (or press Enter) on any line in a traceback to open the offending line in the editor.
As an example, let’s force an error in our test script. Open the same pywindemo.py created earlier and select File → Import. Now close the source file. In the interactive window, type:
PythonWin responds with:
Traceback (innermost last): File "<interactive input>", line 0, in ? File "c:\scripts\pywindemo.py", line 2, in hello print "Hello, " + msg TypeError: illegal argument type for built-in operation >>>
If you double-click on the third or fourth lines of this traceback, the test script is opened, and you are at line 2, the line with the indicated error.