Reboot my rooter with python giving error with pxssh

65 views Asked by At

i want to reboot my rooter using this code:

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?

Any help is appreciated, thanks to all of you

1

There are 1 answers

1
salius On

Looks like a router waiting for the end of a command. Try to use EOF or \n