简体   繁体   English

使用 python 重新启动我的 rooter,给出 pxssh 错误

[英]Reboot my rooter with python giving error with pxssh

i want to reboot my rooter using this code:我想使用以下代码重新启动我的 rooter:

from pexpect.pxssh import pxssh


s = pxssh.pxssh()
s.login('Adress','username','password')
s.sendline('reboot')
s.prompt()
s.logout

But it's giving me this error:但它给了我这个错误:

from pexpect import ExceptionPexpect, TIMEOUT, EOF, spawn
ImportError: cannot import name 'spawn' from 'pexpect' (C:\Users\Hama\AppData\Local\Programs\Python\Python39\lib\site-packages\pexpect\__init__.py)

All what i need is to reboot my rooter one time, that's all, are there other solution to do that under windows 10?我需要的只是重新启动我的rooter一次,仅此而已,在windows 10下还有其他解决方案吗?

Any help is appreciated, thanks to all of you任何帮助表示赞赏,谢谢大家

Looks like a router waiting for the end of a command.看起来像一个等待命令结束的路由器。 Try to use EOF or \n尝试使用EOF\n

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

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