Help with Fortran output
beliavsky at aol.com
beliavsky at aol.com
Mon Aug 30 10:18:09 EDT 2004
"Kumbale, Murali T." <MKUMBALE at southernco.com> wrote in message news:<mailman.2540.1093627522.5135.python-list at python.org>...
> I am new to Python and redirection etc. I created a simple COM object
> in Visual FORTRAN called "disp.disp" that writes to the WINDOWS console.
> I wrote a Python script which looks like the following
>
> import win32com.client
> o = win32com.client.Dispatch("disp.disp")
> o.SimpeAdd(5)
>
> SimpleAdd method takes the argument supplied (the number 5 in this case)
> and adds 10 to it and then writes to FORTRAN standard output using
> WRITE(6,...). This bombs as I don't know how to capture the FORTRAN
> output written to WINDOWS console to Python console. Please help.
I am ignorant of COM, but Fortran (or other) standard output can be
captured by Python. If I compile the Fortran program
write (6,*) "hi from Fortran"
end
to an executable 'foo.exe' and have a Python script 'xread.py'
import sys
text = sys.stdin.readline()
print text
then typing at the Windows command prompt
'foo.exe | python xread.py'
gives the output
hi from Fortran
If this does not answer your question, your problem may be
Fortran-specific -- consider posting to comp.lang.fortran or (even
better) to the Intel Visual Fortran discusssion forum.
More information about the Python-list
mailing list