Posted By: Anonymous
I just started working on Python, and I 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 Settingsflow_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?
Those whitespaces can really be a bother. Try
os.chdir('C:/Documents and Settings/') followed by relative paths for
subprocess methods, or whatever…
If best-effort attempts to bypass the whitespaces-in-path hurdle keep failing, then my next best suggestion is to avoid having blanks in your crucial paths. Couldn’t you make a blanks-less directory, copy the crucial
.exe file there, and try that? Are those havoc-wrecking space absolutely essential to your well-being…?