How to run script from interpreter?
Rolander, Dan
Dan.Rolander at marriott.com
Fri Jan 19 13:27:16 EST 2001
That works great! I did try to sys.argv[1] = "one" but that didn't work. I
realize now that I needed to set the whole list.
Thanks for your help!
Dan
-----Original Message-----
From: Fredrik Lundh [mailto:fredrik at effbot.org]
Sent: Friday, January 19, 2001 12:53 PM
To: python-list at python.org
Subject: Re: How to run script from interpreter?
Dan Rolander wrote:
> One more thing, is there a way to pass a command line parameter to the
> script named in execfile? Say if I have a script to test which expects a
> value in sys.argv[1]?
did you try putting it in sys.argv[1] ?
import sys
sys.argv = ["spam.py", "one", "two", "three"]
execfile("spam.py")
Cheers /F
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list