Skip to content

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

Description

@Prajwal027

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions