How to run an .exe program in the background using python script?

0

I'm working with the arcgis program that reads python language. I already loaded it in the arcgis python scripts and I need in the background to run a program called gams .. For this I needed to create a python script, to add to the others, that would allow doing this and not use the command line ..

Does anyone know how to do this? Thank you !!

    
asked by anonymous 26.04.2016 / 18:37

1 answer

0

To run any command with Python:

>>> import subprocess

# caso queira bloquear e obter a saida em uma variavel
>>> saida = subprocess.check_output(['ls', '-l'])

# caso queira rodar em background:
>>> process = subprocess.Popen('sleep 10'.split())
>>> process.pid  # obtém o PID
11887
>>> process.wait()  # espera processo terminar

Read more:

27.04.2016 / 20:07