On Sep 10, 7:01 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > On Sep 10, 6:04 pm, [EMAIL PROTECTED] wrote: > > > > > Hey , I need toSSHinto a server .. (10.8.42.38) usingpexpectthe > > username is 'admin' and password is 'abc123' so far i have the > > following code > > > importpexpect > > import sys > > import time > > import os > > > foo =pexpect.spawn('[EMAIL PROTECTED]') > > ssh_newKey = 'Are you sure you want to continue connecting' > > > foo.expect = ssh_newKey > > foo.send = 'yes' > > foo.expect = 'password:' > > foo.send = 'abc123' > > > --------------------------------------------------------------------------- > > ---------------------- > > > does this look right? I am using windows and for reason it wont let me use pexpect even tho I have CYGWIN installed
I get the following error Traceback (most recent call last): File "new.py", line 1, in <module> import ssh_session File "C:\Python25\lib\ssh_session.py", line 7, in <module> from pexpect import * File "C:\Python25\lib\site-packages\pexpect.py", line 85, in <module> support it. Pexpect is intended for UNIX-like operating systems.""") ImportError: No module named resource any ideas? Thanks A critical module was not found. Probably this operating system does not support it. Pexpect is intended for UNIX-like operating systems. > > > if not , could someone suggest a way to do this .. > > your help is much appreciated > > https://svn.lal.in2p3.fr/projects/CMT/CMTManagement/utils/ssh_session.py > > I use a modified version of this. Simple and effective. > > import ssh_sessionssh= ssh_session.ssh_session(user, host, password) > printssh.ssh("ls -l /tmp") > > Thanks Eric and Nigel! > > ~Sean -- http://mail.python.org/mailman/listinfo/python-list