process stdin grab

Will Maier willmaier at ml1.net
Thu Jun 28 23:07:01 CEST 2007


On Thu, Jun 28, 2007 at 08:01:18PM +0000, Seltzer wrote:
> I need to send commands to a process that i did not start.
> (mplayer specifically) I have the PIP of the process, and thats
> about all.

I assume you mean 'PID'. This is somewhat offtopic, but mplayer
supports receiving commands from a FIFO:

    mplayer -quiet -slave -idle -input file=/home/you/.mplayer/fifo

Then you can write commands (like 'loadfile song.ogg') to the fifo.
Doing this in Python is as trivial as opening, writing to, and
closing a file object.

> Any ideas on how to do this in python? i need only to write to its
> stdin, not read any information from it, and i don't really need
> to know if my command worked for now, so error handling isn't
> really an issue.

I don't know of any magic to write to a running program's stdin.

-- 

[Will Maier]-----------------[willmaier at ml1.net|http://www.lfod.us/]



More information about the Python-list mailing list