Alex Rivera | Logout

Running an outside program (executable) in Python?

Asked 2009-11-28T05:36:50.403
126

I just started working on Python and have been trying to run an outside executable from Python.

I have an executable for a program written in Fortran. Let’s say the name for the executable is flow.exe, and my executable is located in C:\Documents and Settings\flow_model. I tried both os.system and popen commands, but so far, I couldn't make it work. The following code seems like it opens the command window, but it wouldn't execute the model.

# Import system modules
import sys, string, os, arcgisscripting
os.system("C:/Documents and Settings/flow_model/flow.exe")

How can I fix this?

Edit
Report

1 Answer

1

Is that trying to execute C:\Documents with arguments of "and", "Settings/flow_model/flow.exe"?

Also, you might consider subprocess.call().

answered 2009-11-28T05:39:05.407

Your Answer