I'm trying to instruct my Python installation to execute an Expect script "myexpect.sh":
#!/usr/bin/expect
spawn ssh usr@myip
expect "password:"
send "mypassword
";
send "./mycommand1
"
send "./mycommand2
"
interact
I'm on Windows so re-writing the lines in the Expect script into Python are not an option. Any suggestions? Is there anything that can run it the way "./myexpect.sh" does from a bash shell?
I have had some success with the subprocess command:
subprocess.call("myexpect.sh", shell=True)
I receive the error:
myexpect.sh is not a valid Win32 application.
How do I get around this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…