Unix programmers and Idle

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Mar 31 04:20:28 CEST 2009

En Mon, 30 Mar 2009 22:21:12 -0300, Dale Amon <amon at vnl.com> escribió:

>>> 	vlmdeckcheck.py --strict --debug file.dat
>>> There must be a way to tell it what the command line args
>>> are for the test run but I can't find it so far.
> The line above represent what I want to emulate within idle.
> If you run idle, select File->Open; then select the program name
> as above to open; select Debug->Debugger; then start the program
> with F5... which is lovely but I cannot find a way to tell idle
> what the args are.
> idle is really nice but I am stuck doing my debugging in pdb
> because of this.

It's hard to believe, but AFAIK, there is no way to set the program  
arguments from inside IDLE (and I'd love to be proven wrong!).

You have to set sys.argv by code in your main entry point:

sys.argv[1:] = ["--strict", "--debug", "file.dat"]
sys.argv[1:] = "--strict --debug file.dat".split()

Gabriel Genellina

More information about the Python-list mailing list