简体   繁体   English

使用pxssh时无法为pexpect导入名称“ spawn”

[英]Cannot import name 'spawn' for pexpect while using pxssh

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 我在Windows上使用python3.5

pxssh is not currently supported on Windows. Windows当前不支持pxssh。

You can read more about it on https://github.com/pexpect/pexpect/issues/339 您可以在https://github.com/pexpect/pexpect/issues/339上阅读有关它的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM