On 2/4/2010 3:55 PM, Alan Biddle wrote:
Just finishing my first Python (2.6 on Win XP)  program, which is
working fine.  My "Duh?" question is about how to run it from within
IDLE and pass it command line arguments.  No problem using sys.argv
from a Windows command line, but I have missed how you can do that
from within IDLE, which complicates development and debugging.

I presume you mean edit, F5-run, see result in shell window.
Set sys.argv in test function or __name__=='__main__'
In 3.1 idle shell:

>>> import sys
>>> sys.argv
['']
>>> sys.argv = ['abc','dev']
>>> sys.argv
['abc', 'dev']

I did not know it was writable, either, until I tried it.

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to