I am trying to automate a command line program.
The exe file takes one argument to run. For example:
ztac.exe <mode>
(where mode options are safe, normal or debug).
To run in debug mode I simply type this in the command line:
C:\source>ztac debug
How do I write a Python program to run this ztac.exe file while taking the different modes as inputs?
Rekovni
7,6525 gold badges54 silver badges70 bronze badges
asked Jan 27, 2011 at 7:51
user591821
411 gold badge1 silver badge2 bronze badges
1 Answer 1
program = 'ztac.exe'
arguments = ('safe', 'normal', 'debug')
argument = raw_input('Enter your argument: ')
if argument in arguments:
subprocess.call([program, argument])
else:
print('Illegal Argument')
Sign up to request clarification or add additional context in comments.
1 Comment
user591821
Thanks! That works, however, I cannot run any other code while this is running. there a os.spawn type of implementation that can help me dos this?
lang-py