[wxPython] pipe to wxTextCtrl

Ummm... Sorry to be a dork, but you can't possibly use the statement you
listed below. First, all the variations of win32pipe.popen() take two
parameters (not three): commandstring and mode. Second, for
win32pipe.popen3(), the mode options are "t" or "b", not "r" or "w". :frowning:

Also, the popen2 module simply redirects it's calls to the os.popen
equivalent, so I still have the same problem: "bufsize must be -1". *ugh*

So, it appears that the popen() support under Windows isn't completely
compliant. Oh well... what can you do? Not much, I guess. *grin*

Thanks anyway.

-Sean Laurent-

···

-----Original Message-----
From: Rob Cakebread [mailto:robc@pop3free.com]
Sent: Monday, March 19, 2001 7:16 PM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxpython-users] RE: [wxPython] pipe to wxTextCtrl

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

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