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

时间:2020-03-31 06:53:41

标签: python ios

大家好,我的代码有问题,它没有运行:

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.')

,错误是: AttributeError:'NoneType'对象没有属性'group'

0 个答案:

没有答案