pxssh on Windows

328 views
Skip to first unread message

Ryan Fry

unread,
Apr 30, 2015, 11:15:11 AM4/30/15
to winpe...@googlegroups.com
Hey All,


I've installed winpexpect to my Anaconda Python 2.7 installation on Windows 7 64-bit, but my script uses pxssh to launch SSH sessions. Is there a different command I should use to make it work, or do I have to recode to work with winspawn?

Here's the relevant code snippet:

import pxssh
try:                                                            
    s = pxssh.pxssh()
    #hostname = raw_input('hostname: ')
    #username = raw_input('username: ')
    hostname = '---------'
    username = '---------'
    s.login (hostname, username)
    s.sendline ('psql doit tamr')   # run a command
    s.prompt()             # match the prompt
    print s.before          # print everything before the prompt.
    s.sendline ('12345')
    s.prompt()
    print s.before
    s.sendline('\o ' + hcr_csv_file.replace(directory, ''))
    s.sendline('\i hcr_' + category + '_query.sql')
    s.sendline('\o ' + pde_csv_file.replace(directory, ''))
    s.sendline('\i pde_' + category + '_query.sql')
    s.sendline('\q')
    s.logout()
except pxssh.ExceptionPxssh, e:
    print "pxssh failed on login."
    print str(e)

Thanks,

Ryan
Reply all
Reply to author
Forward
0 new messages