Pexpect question.

Paul Lemelle pdl5000 at yahoo.com
Fri Mar 28 11:12:36 EDT 2008


I am trying separate a script that users pexpect into
various functions within the same expect session.  The
problem is that the function does not return control
back Main.  Any insight into this issue would be
greatly appreciated.  Below is sample code of the
problem.  

Thanks, 
Paul 
____

import pexpect





def sshcon(user, password):

	go = pexpect.spawn ('/usr/bin/ssh -l root %s '%
(user))

	go.expect ('Password: ')

	go.sendline (password)

	go.interact()

	



#get node info for both clusters. 



C1_node = raw_input("Enter the ip address for node on
cluster 1: ")

C1_pass = raw_input("Enter the password for the node
on cluster 1: ")





sshcon(C1_node, C1_pass)



#go to the path

chk.expect('# ')

chk.sendline('ls')

#chk = pexpect.spawn('ls') # veriy that you are
connected

chk.interact()



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the Python-list mailing list