简体   繁体   English

AttributeError: 'NoneType' 对象没有属性 'group' 问题

[英]AttributeError: 'NoneType' object has no attribute 'group' problem

hello guys i have a problem with my code this isn't running:大家好,我的代码有问题,它没有运行:

from napalm import get_network_driver


driver = get_network_driver('ios')
device = driver('192.168.112.130', 'abc', '123')
device.open()


device.load_merge_candidate(filename='IOSConfig.txt')
print(device.compare_config())

if len(device.compare_config()) > 0:
    choice = input('\nWould you like commit these changes? [y/n]: ')
    if choice == 'y':
        print('Committing ...')
        device.commit_config()
    else:
        print('Discarding ...')
        device.discard_config()
else:
    print('No difference')

# close the session with the device.
device.close()
print('Done.')

and the error is: AttributeError: 'NoneType' object has no attribute 'group'错误是:AttributeError: 'NoneType' object has no attribute 'group'

Script is okay , but you need to make sure your cisco device must have real flash and should be enable with SCP server.脚本没问题,但您需要确保您的 cisco 设备必须具有真正的闪存,并且应该启用 SCP 服务器。 In Simulation sometime cisco image doesn't have flash.在模拟中,有时 cisco 图像没有闪存。

Try below with router which have flash.试试下面有闪存的路由器。 Make sure you have user credentials in place already.确保您已准备好用户凭据。 ! aaa new-model ! aaa 新模式! ! aaa authentication login default local aaa authorization exec default local ! aaa 认证登录默认本地 aaa 授权 exec 默认本地! ip scp server enable ! ip scp 服务器启用! archive path flash0:存档路径 flash0:

Script will do below task so your router CMD: 'terminal width 511' 19:23:52 UTC Fri Sep 3 2021 CMD: 'terminal length 0' 19:23:52 UTC Fri Sep 3 2021 CMD: 'dir' 19:23:52 UTC Fri Sep 3 2021 CMD: 'dir flash0:' 19:23:52 UTC Fri Sep 3 2021 CMD: 'dir flash0:/merge_config.txt' 19:23:53 UTC Fri Sep 3 2021 CMD: 'verify /md5 flash0:/merge_config.txt' 19:23:53 UTC Fri Sep 3 2021 CMD: 'show archive config incremental-diffs flash0:/merge_config.txt ignorecase' 19:23:53 UTC Fri Sep 3 2021脚本将执行以下任务,因此您的路由器 CMD: 'terminal width 511' 19:23:52 UTC Fri Sep 3 2021 CMD: 'terminal length 0' 19:23:52 UTC Fri Sep 3 2021 CMD: 'dir' 19:23 :52 UTC 2021 年 9 月 3 日星期五 CMD:'dir flash0:' 19:23:52 UTC 2021 年 9 月 3 日星期五 CMD:'dir flash0:/merge_config.txt' 19:23:53 UTC 2021 年 9 月 3 日星期五 CMD:'验证 / md5 flash0:/merge_config.txt' UTC 时间 2021 年 9 月 3 日星期五 19:23:53 CMD:'显示存档配置增量差异 flash0:/merge_config.txt ignorecase' UTC 时间 2021 年 9 月 3 日星期五 19:23:53

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

相关问题 AttributeError:“ NoneType”对象没有属性“ group” {for instagram} - AttributeError: 'NoneType' object has no attribute ‘group’ {for instagram} AttributeError: 'NoneType' 对象没有属性 'group' , - AttributeError: 'NoneType' object has no attribute 'group' , AttributeError:'NoneType'对象没有属性'group' - AttributeError: 'NoneType' object has no attribute 'group' AttributeError: 'NoneType' object 没有属性 'group - AttributeError: 'NoneType' object has no attribute 'group AttributeError: 'NoneType' object 在 googletrans 中没有属性 'group' - AttributeError: 'NoneType' object has no attribute 'group' in googletrans AttributeError:'NoneType'对象没有属性'group'错误 - AttributeError: 'NoneType' object has no attribute 'group' error AttributeError:'NoneType'对象没有属性'group' - AttributeError: 'NoneType' object has no attribute 'group' AttributeError: 'NoneType' 对象没有属性 - AttributeError: 'NoneType' object has no attribute AttributeError:“ NoneType”对象没有属性“ a” - AttributeError: 'NoneType' object has no attribute 'a' 为什么代码抛出“AttributeError: 'NoneType' object has no attribute 'group'”? - Why is the code throwing "AttributeError: 'NoneType' object has no attribute 'group'"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM