folks, i inherited a python script main using optParse to construct a menu of items for the user to pick through:
def main():
parser = optParse(prog='script')
#parser.add_option("-e","--repeat",dest="repeat",type=int,default=3,help="Total number of times to do the checking.")
parser.add_option("-H","--time",dest="time", type='float', default=1.0,help="Time in hours to run the test.")
what need to do is to call this main function from within a running python session, but don't quite know how to specify the parameters. something similar to this:
import script
script.main(['-e', '5', '-H', '2'])
however, the main function has no input parameters as it is. What is the easiest way to modify main to accomplish passing parameters in the manner specified?
from the answer from Tim Roberts, the following works:
then just calling the following from the running python session: