Python PIP

Hello Frank,

When you get an error like this:

ModuleNotFoundError: No module named 'pyparsing'"

It’s always related that Python is unable to find your module. In this case, it seems that the networkparse module is trying to import the pyparsing module. We can see it here:

File "C:\Python39\lib\site-packages\networkparse\", line 23, in 
    import pyparsing
ModuleNotFoundError: No module named 'pyparsing'"

When you look at the file, you can see this on line 23:

import pyparsing

Try using pip to install pyparsing:

pip install pyparsing

That should solve your issue.

Let me explain this line:

config = parse.ConfigIOS(running_configuration)

In our code, we used from networkparse import parse to import the parse module from the “networkparse” module.

If you want to see what looks like, we can check the git repository here:

I added this file to this post in case it changes in the future and someone wants to follow along.

networkparse_parse.txt (22.3 KB)

The parse module contains a class named ConfigIOS that we call. Our variable running_configuration is the argument that we send to the ConfigIOS class.

I haven’t explained classes in the course, it’s difficult to explain in one or two sentences. Python is an object-oriented programming language. In a nutshell, a class is a blueprint/template for an object. If you look at the code in the repository, you can see the ConfigIOS class is used to parse the configuration file for Cisco IOS.

Does this help? :slight_smile: