Passing command line arguments when debugging with IDLE

Bengt Richter bokr at oz.net
Tue Mar 19 22:26:44 EST 2002


On Tue, 19 Mar 2002 20:43:33 -0500, "Nigel-Fi" <nospam at nospam.com> wrote:

>A newbe question from someone more familiar with devstudio type
>environments...
>
>I have a python program which takes command line arguments and i'd like to
>debug it with IDLE but I cant see how to specify them when I open the py
>file or run it within IDLE.
>
I'd just make a temporary assignment to sys.argv right after the import sys, e.g.,

    import sys
    sys.argv = ['arg0', '-opt', 2, 'etc.']

and then pretend it was set normally. Comment out when ready to run from command line
or other starting method that passes cmd line parameters.

HTH

Regards,
Bengt Richter





More information about the Python-list mailing list