[wxPython] pipe to wxTextCtrl

Interestingly enough, the code below does not seem to work using the
ActivePython 2.0 distribution under Win2K:

Traceback (most recent call last):
  blah blah blah
    cmdStdOut = os.popen(szCabArcCmd, "r", 0);
ValueError: bufsize must be -1

-Sean Laurent-

From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Monday, March 12, 2001 6:28 PM
To: wxpython-users@lists.sourceforge.net
Subject: Re: [wxPython] pipe to wxTextCtrl

<TEXT DELETED>

···

-----Original Message-----

First of all, readlines by definition doesn't return until the EOF is
reached. See the docs. Even if you switch to using
readline() you may not
get what you are looking for if the child process is
buffering its output.
Try this and see how it works:

proc = os.popen("/usr/bin/bla 2>&1", "r", 0)
line = proc.readline()
while line:
    print line
    line = proc.readline()

I thought Python 2.0 had popen support for win32, maybe not?

I had to use something like this for Windows:

i,o,e = win32pipe.popen3(szCabArcCmd, "r", 0)

stdout = o.readline()
#stderr = e.readline()

while stdout:
     print print stdout
     stdout = o.readline()

The win32pipe comes with the "win32all" package, available on ActiveState,
if you don't have it.

···

On Monday 19 March 2001 04:41 pm, you wrote:

Interestingly enough, the code below does not seem to work using the
ActivePython 2.0 distribution under Win2K:

Traceback (most recent call last):
  blah blah blah
    cmdStdOut = os.popen(szCabArcCmd, "r", 0);
ValueError: bufsize must be -1

-Sean Laurent-

> -----Original Message-----
> From: Robin Dunn [mailto:robin@alldunn.com]
> Sent: Monday, March 12, 2001 6:28 PM
> To: wxpython-users@lists.sourceforge.net
> Subject: Re: [wxPython] pipe to wxTextCtrl

<TEXT DELETED>

> First of all, readlines by definition doesn't return until the EOF is
> reached. See the docs. Even if you switch to using
> readline() you may not
> get what you are looking for if the child process is
> buffering its output.
> Try this and see how it works:
>
>
> proc = os.popen("/usr/bin/bla 2>&1", "r", 0)
> line = proc.readline()
> while line:
> print line
> line = proc.readline()

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users