Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-25-2007, 12:37 AM   #1
LQ Newbie
Registered: Oct 2006
Posts: 5

Rep: Reputation: 0
Python waiting function... sort of?

Sorry about the vague subject but I am having trouble describing my needs here.
I am trying to get a python script(We will call it script A) to call another script(Script B), I need Script A to wait until Script B produces some output then process the output accordingly.
I am using popen() currently. I might just be using it incorrectly for what I need to do. Here is what is going on...

 def main():
        lircInput = os.popen("/usr/bin/ircat test")
        if lircInput == "left":
this is just for the testing purposes, but left() and right() both recall my main() function when they are done.

Any help would be great. Thanks.
Old 04-25-2007, 05:36 PM   #2
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
Well you could...

def main():
os.popen("/usr/bin/ircat test")
        while True:
               if lircInput == "left":
I don't know how you'll feel about that. Maybe the program is always running, maybe its not.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Python: making a reference to a function not yet defined JRR883 Programming 1 02-08-2006 11:28 AM
Python function defaults behaving badly DiagonalArg Programming 3 08-24-2005 11:35 AM
C++, using custom function to sort an std::list R00ts Programming 3 01-03-2005 09:41 AM
Python function arguments are dictionaries? johnMG Programming 1 07-24-2004 06:29 PM
simple python function question Tyir Programming 2 03-28-2004 10:53 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration