Advertisement
Senethril

Untitled

Oct 12th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.52 KB | None | 0 0
  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import spur
  4. import spur.ssh
  5. shell = spur.SshShell(hostname=self.host,
  6.                                   username=self.login,
  7.                                   password=self.password,
  8.                                   missing_host_key=spur.ssh.MissingHostKey.accept,
  9.                                   shell_type=spur.ssh.ShellTypes.minimal)
  10. with shell:
  11.     result = shell.run(["ifconfig" ,"br-wan" ,"hw", "ether",NewMac])
  12.  
  13.  
  14. PROBLEM OCCURS ONLY WHEN NOT CLICKED BUT USING schtasks /run /TN "reconnect" OR WINDOWS TASK SCHEDULER
  15. Traceback (most recent call last):
  16.   File "C:\Users\sph\Desktop\pyload\pyload\reconnect.py", line 6, in <module>
  17.     plop.NextRandomIp(maxretry=3,maxtotalretry=3)
  18.   File "C:\Users\sph\Documents\MMEDIA\lib\NextIp.py", line 167, in NextRandomIp
  19.     result = shell.run(["ifconfig" ,"br-wan" ,"hw", "ether",NewMac])#+NewMac.decode("utf-8").encode("ascii","ignore")])
  20.   File "C:\Python27\lib\site-packages\spur\ssh.py", line 162, in run
  21.     return self.spawn(*args, **kwargs).wait_for_result()
  22.   File "C:\Python27\lib\site-packages\spur\ssh.py", line 173, in spawn
  23.     channel = self._get_ssh_transport().open_session()
  24.   File "C:\Python27\lib\site-packages\spur\ssh.py", line 251, in _get_ssh_transport
  25.     raise self._connection_error(error)
  26.   File "C:\Python27\lib\site-packages\spur\ssh.py", line 288, in _connection_error
  27.     "Original error: {0}".format(error)
  28. UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 20: ordinal not in range(128)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement