On Apr 6, 3:22 pm, [EMAIL PROTECTED] wrote:
> On Apr 6, 1:44 pm, "ianaré" <[EMAIL PROTECTED]> wrote:
>
>
>
> > hey all, I'm trying to get real time updates of batch file output.
>
> > Here is my batch file:
> > @echo off
> > echo 1
> > @ping 127.0.0.1 -n 2 -w 1500 > nul
> > echo 2
> > @ping 127.0.0.1 -n 2 -w 1500 > nul
> > echo 3
>
> > If I run it in cmd.exe it will print "1", wait 15sec, print "2", wait
> > 15sec, print "3".
>
> > I tried doing it like this:
>
> > r, w, e = popen2.popen3('"C:/path/to/test.bat"',bufsize=0)
> >     for line in r:
> >         self.display.WriteText(line)
>
> > ... but get: ValueError: popen3() arg 3 must be -1
>
> > If I use -1, then it waits for the batch file to complete, and prints
> > out all 3 lines at once.
>
> > So I tried subprocess:
> > proc = subprocess.Popen('"C:/path/to/test.bat"', bufsize=0,
> >   stdout=subprocess.PIPE)
> > for line in proc.stdout:
> >     self.display.WriteText(line)
>
> > No error message, but no real time printing either.
>
> > info:
> > self.display is a wx.TextCtrl - not that it should matter,as
> > 'WriteText()' behaves basically like 'print'
> > winXP pro SP2, python 2.5, wxPython 2.6.3.3
>
> > You help is appreciated.
>
> Hi,
>
> I think this script on another post will help:
>
> http://groups.google.com/group/comp.lang.python/msg/9fa3a3c287e8e2a3?...
>
> The 4 line code example (from Daniel) in one of the posts at this link
> worked with your batch 
> file:http://www.velocityreviews.com/forums/t350573-redirect-ossystem-outpu...
>
> Mike

Thanks but it doesn't work. Still prints it out all at once. It is
supposed to print, then wait 15sec for the next line to print.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to