Python: 3.12
pySNMP-lexstudio – 6.1.2
pyInstaller – 6.6.0
OS – Windows
Shell – Git Bash/Command Prompt
I have a fairly basic application that is attempting to load some user-specified mibs so that I can resolve the OIDs for basic set/get commands.
In the snippet below mib_paths is a list of paths and mibs is a list of mob file names.
mib_builder = builder.MibBuilder()
# Compile the provided mibs
compiler.addMibCompiler(mib_builder, sources=[pathlib.Path(x).as_uri() for x in mib_paths])
mib_sources = mib_builder.getMibSources()
for path in mib_paths:
mib_sources += (builder.DirMibSource(path),)
mib_builder.setMibSources(*mib_sources)
mib_builder.loadModules(*mibs)
return view.MibViewController(mib_builder)
This code works perfectly when running from the command line, storing the compiled mibs as *.py in C:Users<username>PySNMP Configurationmibs
I generate an executable using the command
pyinstaller.exe -F --paths venvdev/Lib/site-packages/ src/main.py
When running the exe with the same paths, from the same shells and having deleted the compiled mibs I get the follwing:
pysnmp.smi.error.MibNotFoundError: MY-MIB compilation error(s): Jinja template rendering error: pysnmp/mib-definitions.j2 at MIB MY-MIB; Jinja template rendering error: pysnmp/mib-definitions.j2 at MIB SCOPE-NAME-MIB caused by <class 'pysnmp.smi.error.MibNotFoundError'>: MIB file "MY-MIB.py[co]" not found in search path ( list of search paths ..)
The directory it normally stashes the compiled mibs in is listed, but isn't created.
I've searched around but haven't found anything relevant. I'm new to PyInstaller and pySNMP so any help would be appreciated.