Re: [Tutor] pattern matching is too slow

2005-08-12 Thread Vinay Reddy
> Reading through other posts, looks like you got somewhare with the > nonblocking IO. Can you comment on what you did to get it working? The > whole fcntl thing? I am able to use non-blocking I/O, but I am unable to get the mplayer status messages. It's just not there in the mplayer output pipe.

Re: [Tutor] pattern matching is too slow

2005-08-12 Thread Hugo González Monteverde
hi Vinay, Reading through other posts, looks like you got somewhare with the nonblocking IO. Can you comment on what you did to get it working? The whole fcntl thing? Thanks, Hugo Vinay Reddy wrote: > Hi, > I am writing a front-end for an application (mplayer). I used the > popen2 call to ope

Re: [Tutor] pattern matching is too slow (a little OT)

2005-08-12 Thread Hugo González Monteverde
Hi again =) That's exactly why I use "quiet" with MPlayer, because the output is simply too much to be parsed, and MPlayer will block waiting for you to read the buffer (so it stops playing) My suggestion is: forget about parsing the huge amounts of output MPlayer gives, and use its slave mode

Re: [Tutor] pattern matching is too slow

2005-08-12 Thread Alan G
while True: try: temp = self.mplayerOut.readline() print temp if re.compile("^A:").search(temp): The point of re.compile is to compile the re once *outside* the loop. Compiling the re is slow so you should only do it outside. As a first step replace re.compile with re.search

Re: [Tutor] pattern matching is too slow

2005-08-12 Thread Danny Yoo
On Fri, 12 Aug 2005, Vinay Reddy wrote: > I'm using the following code to read from 'mplayerOut': > > while True: > try: > temp = self.mplayerOut.readline() >print temp >if re.compile("^A:").search(temp): > print "abc" > except StandardError: > break > > If th

[Tutor] pattern matching is too slow

2005-08-12 Thread Vinay Reddy
Hi, I am writing a front-end for an application (mplayer). I used the popen2 call to open pipes for bi-directional communication. I set the output pipe from the application to non-blocking mode using: fcntl.fcntl(self.mplayerOut, fcntl.F_SETFL, os.O_NONBLOCK) The problem is that it takes about 10