469,358 Members | 1,628 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Using pxssh

Hello,

I am trying to convert some Expect/Tcl code into Python by using the
Pexpect module. The environment is such that authenticated keys are
disabled although SSH is available. I do not have control over this
environment, so I'm trying to automate tasks within it via Expect.

I noticed that, within the Pexpect documentation, it mentions a class
called "pxssh". Has anyone used this before? If so, I'm having some
trouble importing it. If I just import pxssh doesn't seem to work;
really am not sure how this is related to Pexpect or how to use it
from within it.

Any help is appreciated.
Tom

Mar 19 '07 #1
1 4203
tereglow <to************@eglow.netwrote:
I am trying to convert some Expect/Tcl code into Python by using the
Pexpect module. The environment is such that authenticated keys are
disabled although SSH is available. I do not have control over this
environment, so I'm trying to automate tasks within it via Expect.

I noticed that, within the Pexpect documentation, it mentions a class
called "pxssh". Has anyone used this before? If so, I'm having some
trouble importing it. If I just import pxssh doesn't seem to work;
In what way doesn't it work?
really am not sure how this is related to Pexpect or how to use it
from within it.
It works for me according to the documentation

$ python
Python 2.4.4 (#2, Jan 13 2007, 17:50:26)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import pxssh
s = pxssh.pxssh()
s.login("localhost", "user", "password")
True
>>s.sendline("ls -l")
6
>>s.prompt()
True
>>print s.before
ls -l
total 30944
-rw-r--r-- 1 user user 936 Nov 3 14:52 #z.c#
[snip]
-rw-r--r-- 1 user user 221 Jan 30 11:51 z~
>>s.logout()
I'm using the debian packaged version 2.1-1 with python 2.4

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Mar 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by rawCoder | last post: by
10 posts views Thread by Christopher Benson-Manica | last post: by
17 posts views Thread by beliavsky | last post: by
14 posts views Thread by john.burton.email | last post: by
5 posts views Thread by Enos Meroka | last post: by
7 posts views Thread by gert | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.