I am running a Python program on a Windows XP machine. When I run the program, I get the following error:
File "C:\Python27\lib\pysnmp\smi\builder.pyt, line 230, in loadModules...
pysnmp.smi.error.SmiError: MIB file "SNMPv2-MIB.py[co]" not found in search path
The file SNMPv2-MIB.py is currently located in C:\Python27\Lib\pysnmp\smi\mibs. Does anyone know how I can solve this?
if a mib is missing make sure you have performed a pip install pysnmp-mibs first if you used pip install pysnmp.
I just ran into the same issue. I filed a bug for it and included a patch: https://sourceforge.net/tracker/?func=detail&aid=3204704&group_id=14735&atid=114735
As Sivakumar says, the reason it's failing is because pysnmp is looking for MIBs with a .pyc or .pyw extension. pysnmp gets these extensions from imp.get_suffixes(). Based on the way pysnmp deals with the extensions returned from this function, the .pyw entry will overwrite the .py entry. The fix I proposed will simply ignore the .pyw extension.
If you install the library from the .egg it should work fine because the .egg includes compiled (pyc) MIBs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With