ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
then mplayer start, but (thankfully) debug says something like "mplayer /some/were >/tmp/1" wich seems to be the exact opposite of what i want, well.,, i do needs mplayer output, but I'm not needing or wanting it now
i can get what i want on the command line by using a fifo, but it would be much better if i can go it without using one ..... i looked thru the tutorial on the python site, but it doesn't even at least say how to run a command, let alone run multiple ones at once, or pass info to programs.....
Maybe try out the pty module instead - from my limited tests (I'm not at home with X, and I can't correctly gauge how well it's working over SSH) mplayer doesn't play so nicely with pure pipes.
Usually a process freezes up because a pipe (usually stdout) is 'full' and waiting for you to read it - if you continually read mplayer's output, it should keep going (I had this problem trying to embed an mplayer window in my own app). I also found a nice FAQ entry on this, here: http://www.python.org/doc/faq/librar...put-and-output
ah, yes, that pexpect modules solves the problem, kinda.. (just need to go back to the tutorials i guess..), and like you said it was because i need to read the output
at least i can play files now, and have basic control, tho its a shame mplayer doesn't output how long the file is, just how longs its been playing for (until i telled mplayer to be quiet if it cant coff up what i need to know)
just another quick question (just cause i don't like making new threads)
in python when i tell it code (by running python first so it will let me type the code to learn) when i run a command like "m=os.system('blabla')" it prevents me from typing in new commands. my question is this: is this the same for a script file? will it lock up so that it will prevent further execution of a script until the previous command finishes?
os.system will block unless the program detaches and runs in the background, or you deliberately put it in the background with &. os.popen and friends will not block, because obviously you need to be able to read and/or write the relevant pipes.
SciYro: I'm trying to get MPlayer to work off pipes using bash but I'm having problems with the pipe blocking. You mentioned in your post that you could get the fifo working in bash. If possible, can you please post your fifo script, so I can figure out where I'm going wrong.
All pipes are buffers, with a limited capacity. Once a pipe becomes full, writers are blocked. Once a pipe becomes empty, readers are blocked. The purpose of a pipe is not to store data but only to communicate it, and the buffering provides a "flexible hose" so that the processes are less likely to execute in a lock-step fashion.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.