Please help, there is a problem when executing a script on Paramiko, when displaying information from the switch.Aruba 2530,OS Provision
Script:
import paramiko
import getpass
import time
import json
with open('devices.json', 'r') as f:
devices = json.load(f)
with open ('commands.txt', 'r') as f:
commands = [line for line in f.readlines()]
username = input('Username: ')
password = getpass.getpass('Password: ')
max_buffer = 65535
def clear_buffer(connection):
if connection.recv_ready():
    return connection.recv(max_buffer)
# Starts the loop for devices
for device in devices.keys(): 
outputFileName = device + '_output.txt'
connection = paramiko.SSHClient()
connection.set_missing_host_key_policy(paramiko.AutoAddPolicy())
connection.connect(devices[device]['ip'], username=username, password=password, look_for_keys=False, allow_agent=False)
new_connection = connection.invoke_shell()
output = clear_buffer(new_connection)
time.sleep(3)
#new_connection.send("terminal length 5\n")
output = clear_buffer(new_connection)
with open(outputFileName, 'wb') as f:
    for command in commands:
        new_connection.send(command)
        time.sleep(2)
        output = new_connection.recv(max_buffer)
        print(output)
        f.write(output)
print ("\r\nEXIT"*15)        
new_connection.close()
After execution produces the following: Incomprehensible thing
In the output.txt I have:
In Comware all fine.I know python at a basic level, I don’t understand what this can mean.