Python Forum
Python Pexpect - SSH Timeout
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Pexpect - SSH Timeout
#3
Got to know its getting failed here...

def macGrabber(child,switch,cat = False):
    try:
        if cat is False:
            child.expect('.#')
            child.sendline('sh mac address-table | no-more')
        else:
            child.sendline('sh mac address-table dynamic | i Gi')
        child.expect('.#', timeout=3000)
    except pexpect.TIMEOUT:
        print child.before,child.after
        child.close()
        raise
    macs = child.before
    child.close()
    macs = macs.splitlines()
    print('Connection to %s CLOSED' % switch)
    return macs
Can we set a retry here ?
Reply


Messages In This Thread
Python Pexpect - SSH Timeout - by Nirmal - Oct-16-2018, 11:11 AM
RE: Python Pexpect - SSH Timeout - by wavic - Oct-16-2018, 03:17 PM
RE: Python Pexpect - SSH Timeout - by Nirmal - Oct-17-2018, 01:08 PM
RE: Python Pexpect - SSH Timeout - by wavic - Oct-17-2018, 02:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  telnetlib timeout kerzol81 0 3,489 Sep-12-2019, 08:38 AM
Last Post: kerzol81
  Pexpect - Python 3.7 - Unable to get my script past the login stage lgreenjr 3 3,964 Nov-01-2018, 10:49 PM
Last Post: lgreenjr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020