Calling subprocess with arguments
mk.fraggod at gmail.com
Fri Jun 19 17:21:42 CEST 2009
On Fri, 19 Jun 2009 08:07:29 -0700
Tyler Laing <trinioler at gmail.com> wrote:
> I can't use communicate, as it waits for the child process to terminate.
> Basically it blocks. I'm trying to have dynamic communication between the
> python program, and vlc.
Unfortunately, subprocess module doesn't allow it out-of-the-box, but
you can use fnctl calls to perform non-blocking reads/writes on it's
pipes, like this:
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
After that, you can grab all the available data from the pipe at any
given time w/o blocking.
Try this recipe:
Mike Kazantsev // fraggod.net
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 205 bytes
Desc: not available
More information about the Python-list