python to call or start a fortran a.out
Grant Edwards
grant.b.edwards at gmail.com
Mon Aug 21 12:51:07 EDT 2017
On 2017-08-21, Chet Buell <clbuell at ncsu.edu> wrote:
> Need some help with updating python to call or start a fortran a.out
> executable
>
> The problem I am having is I have an old Fortran based model that I need
> to run, in the past the fortran was triggered through the following
> python code:
>
> #run fortran
> x = commands.getoutput(path+'/a.out')
>
> Since the commands.getoutput has been depreciated it will not run on the
> newly built server that will now host this model. I have manually
> confirmed that the compiled a.out does run and produces the files, but
> the problem I am having is in triggering it to run with python.
>
> The answer is probably so easy it is obviously being overlooked, but I
> can not seem to find it. Any suggestions or help would be greatly
> appreciated.
https://docs.python.org/2/library/commands.html:
Deprecated since version 2.6: The commands module has been removed
in Python 3. Use the subprocess module instead.
The subprocess module provides more powerful facilities for
spawning new processes and retrieving their results. Using the
subprocess module is preferable to using the commands module.
https://docs.python.org/2/library/subprocess.html#popen-constructor:
--
Grant Edwards grant.b.edwards Yow! I'm encased in the
at lining of a pure pork
gmail.com sausage!!
More information about the Python-list
mailing list