pxssh.pxssh() is producing error in python -
pxssh.pxssh() is producing error in python -
i got next errors when run pxssh.pxssh() in python. please allow me know missing here.
exception attributeerror: "'pxssh' object has no attribute 'closed'" in <bound method pxssh.__del__ of <pexpect.pxssh.pxssh object @ 0x10d98e910>> ignored ......... file "/users/any_user/system/somelibrary_lib.py", line 377, in login ssh = pxssh.pxssh(maxread=read_buffer, ignore_sighup=false) typeerror: __init__() got unexpected keyword argument 'ignore_sighup'
.........
i faced same problem. solution found utilize ssh_opts
property of pxssh
object instead of options
ctor (__init__
) argument. code looks this:
s = pxssh.pxssh() s.ssh_opts += " -o stricthostkeychecking=no" s.force_password = true s.login(ip, user, passwd)
it doesn't throw attributeerror
exception on module initialization , typeerror
too. still doesn't work me. if remote server has motd
or shell initialization on startup, break logic of pxssh
. made next trick:
s.login(ip, user, passwd, original_prompt = "last login:")
shell writes on each successful login line last login: %date% %ip%
. used verify successful logon. now, using s
can execute remote commands. original (default) value original_prompt
r"[#$]"
. may need somehow combine them right pxssh
work. may need add together >
original_prompt
if connecting sql
shell or cisco
devices.
python-2.7
Comments
Post a Comment