Passing command line arguments when debugging with IDLE

Bengt Richter bokr at oz.net
Wed Mar 20 00:03:28 EST 2002


On 20 Mar 2002 03:26:44 GMT, bokr at oz.net (Bengt Richter) wrote:

>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.']
>
Oops, that 2 should also have quotes. Every arg from sys.argv will normally be a string.

>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
Sorry 'bout that.
>
>Regards,
>Bengt Richter
>
>




More information about the Python-list mailing list