Advertisement
johnmahugu

python - running an external program (executable) with param

Jul 8th, 2015
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. #__author__:: john kesh mahugu johnmahugu at gmail
  2. # running an external program (executable) with parameter with python
  3. program = 'myprogramname.exe'
  4. arguments = ('safe', 'normal', 'debug')
  5. argument = raw_input('Enter your argument: ')
  6. if argument in arguments:
  7.   subprocess.call([program, argument])
  8. else:
  9.   print('Illegal Argument')
  10. '''
  11. Hi I am trying to automate a command line program.
  12. The exe file take one argument to run.
  13. Example myprogramname.exe (say mode options are safe, normal or debug)
  14. to run in debug mode I simply type this in the command line:
  15. C:\source>myprogramname debug
  16. How do I write python program to run this ztac.exe file taking the different modes as inputs?
  17. '''#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement