O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Command-Line Parameters

PythonWin supports a number of command-line parameters as shown in this table.

Command Line

Description

/edit filename

Starts PythonWin and opens the named file for editing.

/run filename

Starts PythonWin and runs the specified script.

/nodde

Must be the first parameter. Starts PythonWin without DDE support, allowing for multiple PythonWin instances.

/app appmodule

Treats the named file as a PythonWin application. This is for advanced users only and is discussed in Chapter 20.

By default, PythonWin allows only one instance to be open. If you attempt to start a new instance of PythonWin, the existing instance is reused, primarily to support better integration with Windows Explorer, as described later in this chapter. PythonWin uses Dynamic Data Exchange (DDE) to communicate between instances, so the /nodde parameter can disable this behavior and allow as many PythonWin instances as you care to start.

To demonstrate these command lines, close the source file pywindemo.py (leave PythonWin running) and start a command prompt window. Enter the command:

C:\Somewhere> start pythonwin.exe /edit C:\Scripts\pywindemo.py

You should see your existing PythonWin application come to the foreground, and see pywindemo.py opened for editing. Switch back to the command prompt and enter the command:

C:\Somewhere> start pythonwin.exe /run c:\Scripts\pywindemo.py

You should see the same messages printed as when you ran the script directly from PythonWin. Finally, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required