sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #24654
[Question #245223]: How to pass command line arguments to script
New question #245223 on Sikuli:
https://answers.launchpad.net/sikuli/+question/245223
I am on mac running sikuli IDE 1.0.1
I have a script with the following in it:
from sys import *
browsername = "Firefox"
if len(sys.argv) > 0:
browsername = sys.argv[0]
else:
stack = traceback.extract_stack(limit = 2)
print '[Error]: ' + str(stack[0][1])
If I remove the if len(sys.argv) and so forth through the else then my script works
If I remove the else but still have the if then the script still fails (so even if there is some problem with my attempt to get the stack trace it is not that problem that concerns me (especially as I only added that trying to figure out what is wrong with the sys.argv stuff.
the rest of my script works fine (automating firefox, going and clicking on some links, looking for part of a form to show up etc. ) so I am not including it, What I really want to know is how to get the value of the first command line argument or if there is no command line argument don't evaluate the part of the script inside of that if.
Thanks,
Bryan
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.