LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 04-25-2007, 12:37 AM   #1
billyseth
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...


Code:
 def main():
        lircInput = os.popen("/usr/bin/ircat test")
        if lircInput == "left":
                left()
        else:
                right()
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
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
Well you could...

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


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:48 PM.

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