def __init__(self): self.proc = subprocess.Popen(self.path, shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE) def read(self): ret = '' count = 1 while True: count += 1 x = select.select([self.proc.stdout.fileno()], [], [], 0.1)[0] if x: s = self.proc.stdout.read(1) ret += s if ret[-1]=='*': вот тут бы я и выходил из цикла, но звездочки то нет :((( else: if select.select([self.proc.stderr.fileno()], [], [], 0.1)[0]: break time.sleep(.3) return ret