I tried to change the timeout value from 30 to 90 for pexpect in the following script...
#!/usr/bin/python import telnetlib import time import pexpect def get_name(): user = raw_input("\nUsername: ") password = raw_input("Password: ") idle(user, password) def idle(user, password): child = pexpect.spawn('telnet game.mortalrealms.com 4321') child.expect("Who art thou:", timeout=90) child.sendline(user) print "\nEntered username.." child.expect("Password:",timeout=90) child.sendline(password) print "Entered pass.." child.expect('Press return to continue:', timeout=90) child.sendline('\n') if child == 2: print "Connection timeout" elif child == 3: print "Another timeout" #while 1: child.expect('Druidess Supi burps loudly.') child.sendline('say oh my aching back') #time.sleep(15) #time.sleep(5) #now.write("\n") #while 1: # now.write("wc") # time.sleep(15) if __name__ == "__main__": get_name() However, when I run it, the timeout still shows 30 seconds... Entered username.. Entered pass.. TrF[;37;44mAv[;33;44mAvaricest): File "./mort.py", line 42, in ? F[;37;44mAv[;33;44mAvarice File "./mort.py", line 10, in get_name idle(user, password) File "./mort.py", line 31, in idle child.expect('Druidess Supi burps loudly.') File "/usr/lib/python2.4/site-packages/pexpect.py", line 1311, in expect return self.expect_list(compiled_pattern_list, timeout, searchwindowsize) File "/usr/lib/python2.4/site-packages/pexpect.py", line 1325, in expect_list return self.expect_loop(searcher_re(pattern_list), timeout, searchwindowsize) File "/usr/lib/python2.4/site-packages/pexpect.py", line 1409, in expect_loop raise TIMEOUT (str(e) + '\n' + str(self)) pexpect.TIMEOUT: Timeout exceeded in read_nonblocking(). <pexpect.spawn object at 0xb7f6f3cc> version: 2.3 ($Revision: 399 $) command: /usr/kerberos/bin/telnet args: ['/usr/kerberos/bin/telnet', 'game.mortalrealms.com', '4321'] searcher: searcher_re: 0: re.compile("Druidess Supi burps loudly.") buffer (last 100 chars): all. before (last 100 chars): all. after: pexpect.TIMEOUT match: None match_index: None exitstatus: None flag_eof: False pid: 23652 child_fd: 3 closed: False timeout: 30 delimiter: pexpect.EOF logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 What am I doing wrong? -- http://mail.python.org/mailman/listinfo/python-list