All pastes #19626 Raw Edit

man_in_shack

public python v1 · immutable
#19626 ·published 2005-08-09 17:01 UTC
rendered paste body
#!/usr/bin/python2.4## Python 2.4 required for subprocess moduleimport sys,osimport 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).stdoutline=''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()