Help with Fortran output

K

Kumbale, Murali T.

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.

Murali
 
B

beliavsky

Kumbale said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,065
Members
47,672
Latest member
svaraho

Latest Threads

Top