PyInstaller does NOT work when including Pysnmp

后端 未结 3 1613
梦谈多话
梦谈多话 2020-12-22 00:48

Just trying one of the official documentation site examples:

from pysnmp.hlapi import *

errorIndication, errorStatus, errorIndex, varBinds = next(
    getCm         


        
3条回答
  •  温柔的废话
    2020-12-22 01:27

    To make Jeremy's answer portable, you can modify your specfile like this diff:

    + import os.path
    + import pysmi
    + import pysnmp.smi.mibs
    
    + def module_base(module):
    +   return os.path.abspath(os.path.join(module.__file__, os.pardir))
    
      coll = COLLECT(
          exe,
          a.binaries,
          a.zipfiles,
          a.datas,
    +     Tree(module_base(pysmi), prefix='pysmi'),
    +     Tree(module_base(pysnmp.smi.mibs), prefix='pysnmp/smi/mibs'),
          ...
    

    EDIT: turn out adding these to hiddenimports solved the problem for me:

    'pysnmp.smi.mibs', 'pysnmp.smi.mibs.instances', 'pysnmp.smi.exval', 'pysnmp.cache'
    

提交回复
热议问题