Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'confparser' has no attribute 'Dissector' #14

Open
Prajwal027 opened this issue Sep 11, 2024 · 1 comment
Open

Comments

@Prajwal027
Copy link

Prajwal027 commented Sep 11, 2024

Hi @tdorssers ,
I am getting this error When parsing:

This is python script:
import confparser

doc = '''

  • match: interface (\S+)
    parent: interface
    child:
    • match: ip address (.*)
      name: ipv4
      action: cidr
    • match: standby (\d+) ip (?P\S+)
      parent: standby
    • match: switchport trunk allowed vlan (\S+)
      name: allowed_vlan
      action: expand
      '''
      cfg = '''
      interface GigabitEthernet1/1/1
      switchport trunk allowed vlan 10-12,15
      !
      interface Vlan10
      ip address 10.10.10.2 255.255.255.0
      standby 10 ip 10.10.10.1
      !
      '''
      print(confparser.Dissector(doc).parse_str(cfg))

The error:
C:\Users\prajwal.pm\PycharmProjects\pythonProject.venv\Scripts\NCS\ConfigParser\Conf.py:3: SyntaxWarning: invalid escape sequence '\S'
doc = '''
Traceback (most recent call last):
File "C:\Users\prajwal.pm\PycharmProjects\pythonProject.venv\Scripts\NCS\ConfigParser\Conf.py", line 25, in
print(confparser.Dissector(doc).parse_str(cfg))
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'confparser' has no attribute 'Dissector'
Thank you.

@bdrosenb
Copy link

I had the same issue. have you tried running your script within the example directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants