why i am getting re.error: unbalanced parenthesis at position 0 error here?

177 views Asked by At

i am trying to send some configuration to my netgear switch using ssh with the function send_config_set()

Netgear_M4100_66={'device_type':'netgear_prosafe',
        'host':'172.16.97.66',
        'username':'admin',
        'password':'******',
        }
    

all_devices=[Netgear_M4100_66]
config_commands=['interface vlan 97']

    
for device in all_devices:    
    
    net_connect = ConnectHandler(**device,fast_cli=True)
    net_connect.enable()
    net_connect.send_config_set(config_commands)
    output=net_connect.send_command('show port status all')
    print("\n\n------------- Device {0} = {1} -------------".format(device['device_type'],device['host']))
    print(output)
    print("----------- End ------------")

this the traceback

`Traceback (most recent call last):
File "add_Switch_netmiko.py", line 118, in <module>
options()
File "add_Switch_netmiko.py", line 99, in options
config_mehrere_Switche()
File "add_Switch_netmiko.py", line 80, in config_mehrere_Switche 
net_connect.send_config_set(config_commands)
File "/usr/local/lib/python3.6/dist-packages/netmiko/base_connection.py", 
line 1837, in send_config_set
output += self.config_mode(*cfg_mode_args)
File "/usr/local/lib/python3.6/dist- 
packages/netmiko/netgear/netgear_prosafe_ssh.py", line 29, in config_mode
return super().config_mode(config_command=config_command, pattern=pattern)
File "/usr/local/lib/python3.6/dist- 
packages/netmiko/cisco_base_connection.py", line 41, in config_mode
config_command=config_command, pattern=pattern, re_flags=re_flags
File "/usr/local/lib/python3.6/dist-packages/netmiko/base_connection.py", 
line 1728, in config_mode
if not re.search(pattern, output, flags=re_flags):
File "/usr/lib/python3.6/re.py", line 182, in search
return _compile(pattern, flags).search(string)
File "/usr/lib/python3.6/re.py", line 301, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.6/sre_compile.py", line 562, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.6/sre_parse.py", line 869, in parse
raise source.error("unbalanced parenthesis")
sre_constants.error: unbalanced parenthesis at position 0`

after looking to all the examples on the internet, this should be working, but unfortunately, it's not . i thought the problem would be with python3.6 so i upgraded it to the newest python3.8 but still getting the same problem.

0

There are 0 answers