Im trying to backup my running-configs of my huawei routers to a text file. Everything works fine except for the part where I decided to save it in text file. The below error message is what I receive:
TypeError: write() argument must be str, not AggregatedResult
My question is, is there a similar function like print_result() which prints the output to a .txt file instead of printing to the console?
If there’s none, then what other workarounds are there for me?
Thank you in advance for your help. Please find below my code.
from nornir import InitNornir
from nornir.plugins.tasks.networking import netmiko_send_command, netmiko_send_config
from nornir.plugins.functions.text import print_result
nr = InitNornir(config_file=“config.yaml”, dry_run = True)
results = nr.run(task = netmiko_send_command,command_string=“display curr”)
f = open(“BackUp.txt”, “w+”)