Cannot import name 'spawn' for pexpect while using pxssh

廉价感情. 提交于 2021-02-18 21:10:01

问题


This is the code I am trying to run:

from pexpect import pxssh
s = pxssh.pxssh()
if not s.login ('myip', 'myusername', 'mypassword'):
    print ("SSH session failed on login.")
    print (str(s))
else:
    print ("SSH session login successful")
    s.sendline ('ls -l')
    s.prompt()         # match the prompt
    print (s.before)     # print everything before the prompt.
    s.logout()

The error which I am getting on running this is :

Traceback (most recent call last):
  File "test_pexpect.py", line 1, in <module>
    from pexpect import pxssh
  File "C:\Python35\lib\site-packages\pexpect\pxssh.py", line 23, in <module>
    from pexpect import ExceptionPexpect, TIMEOUT, EOF, spawn
ImportError: cannot import name 'spawn'

Can anyone help me out? I am using python3.5 on windows


回答1:


pxssh is not currently supported on Windows.

You can read more about it on https://github.com/pexpect/pexpect/issues/339



来源:https://stackoverflow.com/questions/36873940/cannot-import-name-spawn-for-pexpect-while-using-pxssh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!