tags:

views:

60

answers:

2

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

Does anyone know how I can solve this? The file SNMPv2-MIB.py is currently located in C:\Python27\Lib\pysnmp\smi\mibs

A: 

You are not able to load the MIB file.

Can you check :

>>> print builder.MibBuilder().getMibPath()

Usually this should be ok as the mib instances should be in

pysnmp/smi/mibs/instances

Code where error is raised in builder.py

if not self.__modSeen.has_key(modName):
    raise error.SmiError(
        'MIB file \"%s\" not found in search path' % (modName and modName + ".py[co]")
            )

Usually this should get solved by calling setMibPath on the mibBuilder instance before calling loadModules.

Since the path you are getting

C:\Python27\lib\pysnmp\smi\mibs\instances, 
C:\Python27\lib\pysnmp\smi\mibs, 
C:\Python27\lib\pysnmp_mibs

Why don't you move the file to one of these directories? The place where it is currently located

  • C:\Python27\Lib\pysnmp\smi\mibs

is not among the paths that you got via builder.MibBuilder().getMibPath()

pyfunc
I get the following:
Lulu
C:\Python27\lib\pysnmp\smi\mibs\instances, C:\Python27\lib\pysnmp\smi\mibs, C:\Python27\lib\pysnmp_mibs
Lulu
why is it looking for "SNMPv2-MIB.py[co]" instead of SNMPv2-MIB.py?
Lulu
@Lulu : See my reply edit above
pyfunc
A: 

The place it's located is in the path.... What do you mean? Is it because I have Lib instead of lib?

Cathy