On Nov 7, 6:27 am, "Russ P." <[EMAIL PROTECTED]> wrote:
> Is it possible to pass command-line arguments when running a program
> in IDLE? The "Run" menu does not seem to provide that option. Thanks.
Can't you just fake the command line args by setting sys.argv? This
isn't too sophisticated, but it appears to work:
import sys
try:
__file__
except:
sys.argv = ['scriptname.py', 'this','is','a','test','within','idle']
for arg in sys.argv:
print arg
Running from within IDLE:
>>>
scriptname.py
this
is
a
test
within
idle
>>>
Running from the command prompt:
C:\Python24>python.exe mystuff/argtest.py this is yet another test
mystuff/argtest.py
this
is
yet
another
test
C:\Python24>
HTH,
Don
--
http://mail.python.org/mailman/listinfo/python-list