Use kermit through terminal-server from python

577 views Asked by At

I would like to use kermit through terminal server from a Python code. I tried to solve it with pexpect module but after the spawn it logs out with EOF so the child is dead.

    child = pexpect.spawn('echo os.environ["MODULESHOME"]/init/sh; module add kermit; kermit kermit-vpp.kermit -- ' + target + ' ' + port)
    child.maxread=1000

    i = child.expect_exact(['-----------', 'U-Boot', pexpect.EOF, pexpect.TIMEOUT], timeout=20)
    print child.before
    if i == 1:
        print '****Timeout'
        sys.exit(1)
    if i == 2:
        print '****Eof'
        sys.exit(1)

Is there any idea to solve it?

0

There are 0 answers