Newbie has trouble with in/output

Florian W. Florian.W. at p98.f112.n480.z2.fidonet.org
Thu Jul 1 21:08:21 EDT 1999


From: "Florian W." <flowit at hotmail.com>

Hello Python-people

I have two little problems with Python (using WinNt )

1.) Being in a pipe:

I won't to filter the output of the compiler (e.g. only errors and warning
are reported, no logo etc.)
using the pipe-mechanismen :

cl.exe blabla | python filter_compiler_output.py

How do I catch the input and how do print the output ?
The processing requires line-oriented handling, so that I can't catch all
input first, process it as a block and finally display it all at once.
Is the way of calling correct at all ?

2.) Catch the output of an application:

This time I call the compiler myself (e.g. os.system('c:\cl.exe blabla'))
and
want to process the output of the compiler. But how do I catch it ?
os.system just returns the error code. And hacks like c:\cl.exe blabla >
output.txt
don't look very good. (Especially if there are some perl-hackers)

Mfg Florian








More information about the Python-list mailing list