I am currently creating a launcher (launcher.py) in Python 2.7 which can be used from GUI and terminal input. The launcher combines already eisting Software, that has its own GUI and its own terminal mode.
I added an OptionParser (option.py) to start the embedded tools (app.py) directly from the launcher.
App.py executes and is generating correct results, BUT terminal always throws following error:
Usage: launcher.py [options] arg1 arg2
launcher.py: error: no such option -i
here is the option.py file: (is imported as module to launcher.py)
def execute():
tapp_object = tapp.TALP()
input_file = sys.argv[sys.argv.index('-input') + 1]
tapp_object.run(gui=False, filename=input_file)
class Options(OptionParser):
usage = "Usage: %prog arg1 "
parser = OptionParser(usage=usage)
def tapp_batch(option, opt, value, parser):
p = mp.Process(target=execute)
p.start()
p.join()
parser.add_option('--tapp',
'--tAPPLICATION',
action="callback",
callback=tapp_batch,
help='''start APP from batch mode using:
-launcher.py --tapp -input filename.yml
add filename.yml file containing''' )
i tried to do an dirty fix, calling a 'pass' function for flag -i but then it throws the same error for -n -->
Usage: launcher.py [options] arg1 arg2
launcher.py: error: no such option -n
reading full -input string. Why ? and how do I fix it. Please help.