vincentbernat / snimpy

interactive SNMP tool with Python
http://snimpy.readthedocs.org/
185 stars 44 forks source link

recent pyasn1 breaks pysnmp (No module named 'pyasn1.compat.octets') #113

Closed cbueche closed 2 weeks ago

cbueche commented 2 weeks ago

I'm updating an old project using modern Python and modules. If I add snimpy to my requirements.txt, it pulls all dependencies needed. However, pyasn1 0.6.1 breaks pysnmp-lextudio==5.0.34, because of removed functions in pyasn1. Here the stack dump :

Traceback (most recent call last):
  File "/appl/Agent-Jones/aj/aj.py", line 71, in <module>
    import snmpmgr
  File "/appl/Agent-Jones/aj/snmpmgr.py", line 13, in <module>
    from snimpy.manager import Manager as M
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/snimpy/manager.py", line 34, in <module>
    from snimpy import snmp, mib, basictypes
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/snimpy/snmp.py", line 34, in <module>
    from pysnmp.entity.rfc3413.oneliner import cmdgen
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 10, in <module>
    from pysnmp.hlapi.asyncore import *
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/pysnmp/hlapi/__init__.py", line 7, in <module>
    from pysnmp.proto.rfc1902 import *
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/pysnmp/proto/rfc1902.py", line 8, in <module>
    from pysnmp.proto import rfc1155, error
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/pysnmp/proto/rfc1155.py", line 10, in <module>
    from pysnmp.proto import error
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/pysnmp/proto/error.py", line 9, in <module>
    from pysnmp import debug
  File "/appl/Agent-Jones/venv/lib/python3.12/site-packages/pysnmp/debug.py", line 8, in <module>
    from pyasn1.compat.octets import octs2ints
ModuleNotFoundError: No module named 'pyasn1.compat.octets'

Fix : specifying pyasn1==0.5.1 before snimpy in requirements.txt.

Not sure what would be the appropriate way to fix this, in some dependency maybe ?

grant-allan-ctct commented 2 weeks ago

Does information in this issue help any?

vincentbernat commented 2 weeks ago

I have pushed f22d1994a9771858bb30ff3c0801a121e45c145b last month. I need to take some time to test Snimpy with recent versions of pysnmp-lextudio and fix the remaining bugs.

cbueche commented 2 weeks ago

oh great, no hurry, as it's a known issue and a fix is underway, I'll close the issue. Thank you for the great support !