[Tutor] os.system sending of break signals

Liam Clarke ml.cyresse at gmail.com
Fri Oct 28 14:39:33 CEST 2005


Alan Gauld wrote:
>
> You can read the output of popen into your program with
> f.read(), but that will read all of the output after the program
> has run. However I think you can readline() too to catch it
> line by line. You can also write() data to f thus allowing you
> to send your Ctrl-C.(You may need popen2 or even popen3
> to do the simultaneous read//write bit. #Or better still use
> the new subprocess module in v2.4)

>

Quick query with os.popen, popen2,3,4. Playing with IronPython, and
decided to see what I could do with os.popen() and it. With the
various popens, calling read() would block, as would calling
readline() when what was currently displayed was the ">>>" prompt.

What would be causing this? Is it because having displayed the ">>>"
IronPython is looping waiting for input?

It was pure mucking about, really, but curiosity... the .NET framework
has some sane access to various bits of Win32, and if it weren't for
the grinding loadtime of the CLR, I'd like to use IronPython scripts
to get data which normal Python could then grab as text (on account of
how there's no compatiable serialisation between the two), thus
forgoing having to deal with the Win32 API.

Regards,

Liam Clarke


More information about the Tutor mailing list