Re: [pysnmp-dev] SmiError: MIB file "SNMPV2-MIB.py[co]" not found in search path
Brought to you by:
elie
From: Steve H. <ste...@gm...> - 2014-06-03 00:24:02
|
Thanks Ilya. On Fri, May 30, 2014 at 7:51 PM, Ilya Etingof <il...@gl...> wrote: > > Hi Steve, > > Here’s an except from pysnmp-apps package's setup.py related to py2exe > invocation: > > if "py2exe" in sys.argv: > import py2exe > # fix executables > params['console'] = params['scripts'] > del params['scripts'] > # add files not found my modulefinder > params['options'] = { > 'py2exe': { > 'includes': [ > 'pysnmp.smi.mibs.*', > 'pysnmp.smi.mibs.instances.*', > 'pysnmp.entity.rfc3413.oneliner.*' > ], > 'bundle_files': 1, > 'compressed': True > } > } > > try: > import pysnmp_mibs > except ImportError: > print('NOT including pysnmp-mibs!') > else: > print('Including pysnmp-mibs....') > params['options']['py2exe']['includes'].append('pysnmp_mibs.*') > > params['zipfile'] = None > > print("!!! Make sure your pysnmp/pysnmp-mibs/pyasn1 packages are NOT > .egg'ed!!!") > > So the trick is to explicitly include dynamically loaded Python modules > into py2exe pack. > > -ilya > > On 28 May 2014, at 06:27, Steve Hutchins <ste...@gm...> wrote: > > Hi, I get this error when running from py2exe generated executable. > My platform is: Windows 7, python 2.7 with pysnmp 2.4.5 (installed by pip) > > --- Here's my python script (main.py) which is a small extract to > reproduce problem in a larger program: > > import pysnmp.smi.builder > builder = pysnmp.smi.builder.MibBuilder() > builder.loadModules('SNMPv2-MIB') > > --- Here's my py2exe script: > > from distutils.core import setup > import py2exe > setup(console=['main.py']) > > --- Here's the output: > > >main.exe > Traceback (most recent call last): > File "main.py", line 5, in <module> > File "pysnmp\smi\builder.pyc", line 270, in loadModules > pysnmp.smi.error.SmiError: MIB file "SNMPv2-MIB.py[co]" not found in > search path > > > I have searched on this error and seen list entry 'Re: [pysnmp-dev] py2exe > binary error with pysnmp 4.2.3' but this infers that it has subsequently > been fixed in 4.2.4 rc2. > If I run 'python main.py' from the command line it works ok. > > Is there anything I can do to force the load of SNMPV2-MIB.pyc or compile > the SNMPV2-MIB.py at runtime to get around this? > > > |