Mailing List Archive

Newbie has trouble with in/output
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
Newbie has trouble with in/output [ In reply to ]
Florian W. wrote in message <7lglb4$ksu$1@news.vossnet.de>...
>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 ?

You simply read() to get the input, and print to write output!!

>2.) Catch the output of an application:

Check out the win32pipe module in the win32all package. Documentation
(sort-of :) is in the help file, or searching dejanews for that module name
will return plenty of hits...

Mark.
Newbie has trouble with in/output [ In reply to ]
From: "Florian W." <flowit@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
Newbie has trouble with in/output [ In reply to ]
From: "Mark Hammond" <MHammond@skippinet.com.au>

Florian W. wrote in message <7lglb4$ksu$1@news.vossnet.de>...
>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 ?

You simply read() to get the input, and print to write output!!

>2.) Catch the output of an application:

Check out the win32pipe module in the win32all package. Documentation
(sort-of :) is in the help file, or searching dejanews for that module name
will return plenty of hits...

Mark.