#!/usr/bin/python2.4 ## Python 2.4 required for subprocess module import sys,os import subprocess # 2.4 and later # command is one of "tzap", "czap" or "szap" # channel is the arg passed to *zap # The *zap programs output continuously, meaning they keep spitting out lines till the program is stopped. chilin=os.popen("%s '%s'"%(command,channel),'r',0) #chilin=subprocess.Popen("%s '%s'"%(command,channel),stdout=subprocess.PIPE,shell=True,bufszie=0).stdout line='' while line.find('adaptor')<0: line=chilin.read(1) print "Adaptor %s"%line[line.find('adaptor')+7] # print the character after "adaptor" while line: # I haven't got any more of this done because the "Adaptor" never gets printed line=chilin.readline()