[Tutor] REG : Pexpect timeout issue

Steven D'Aprano steve at pearwood.info
Sat Sep 1 10:31:11 EDT 2018


On Sat, Sep 01, 2018 at 11:41:42AM +0000, krishna chaitanya via Tutor wrote:
> Hi Team,
> Below is my code, i am frequently hitting timeout issue to login to linux or router.

Timeout issues are a network problem. Perhaps your network is too busy, 
or the cable is faulty, or your router is being hammered by attackers 
and can't respond.

You would need to discuss this with an experienced network administrator 
to determine what is causing the timeouts.

> import pexpect
> from pexpect import *
> child = spawn('su xxxxx',timeout = 50)
> child.expect('Password:',timeout = 50)
> child.sendline('XXXXXXX') #child.sendline('ls -l')#
> chasis = child.before.decode('utf-8')
> child.expect('krishna at krishna-desktop:~/python_excercises$',timeout = 50)
> child.sendline('ls -l')
> chasis = child.before.decode('utf-8')
> print(chasis)
>
> Error :
>     raise TIMEOUT(msg)pexpect.exceptions.TIMEOUT: Timeout exceeded.<pexpect.pty_spawn.spawn object at 0x7f068506fa20>
> 
> Please guide me.
> Krishna.
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list