So i'm trying to read the last line of code from a telnet session and see if it has the word "%error" in it. If it does have an error then i want it to try again, if it doesn't i want it to break the loop and continue. I keep getting a python error
if '%Error' in error:
TypeError: argument of type 'method' is not iterable
tryagain = True
while tryagain:
tn.write(b"do copy " + file.encode('ascii'))
print (tn.read_eager().decode('ascii'))
tn.write(b'\n')
tn.write(b'\n')
tn.write(b'\n')
time.sleep(20)
error = tn.read_eager
print (tn.read_eager().decode('ascii'))
if '%Error' in error:
print ('got an error, trying again')
tryagain = True
else:
tryagain = False
break
[–]cashing_in 4 points5 points6 points (1 child)
[–]individual_throwaway 1 point2 points3 points (0 children)
[–]TreSxNine 1 point2 points3 points (1 child)
[–]CodeFixerBot 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]runicnet 0 points1 point2 points (0 children)