etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
584 stars 200 forks source link

<lambda>() takes 3 positional arguments but 4 were given #440

Closed ashhhi closed 1 year ago

ashhhi commented 1 year ago

In windows, the code works perfect, but when I put it in Linux, something happened! Traceback (most recent call last): File "SNMP_NGPON (2).py", line 83, in <module> snmp_run_v2.nextcmd() File "SNMP_NGPON (2).py", line 58, in nextcmd snmpEngine.transportDispatcher.runDispatcher() File "/home/calix/.local/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 50, in runDispatcher raise PySnmpError('poll error: %s' % ';'.join(format_exception(*exc_info()))) pysnmp.error.PySnmpError: poll error: Traceback (most recent call last): ; File "/home/calix/.local/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher use_poll=True, map=self.__sockMap, count=1) ; File "/usr/local/python3.6.5/lib/python3.6/asyncore.py", line 207, in loop poll_fun(timeout, map) ; File "/usr/local/python3.6.5/lib/python3.6/asyncore.py", line 188, in poll2 readwrite(obj, flags) ; File "/usr/local/python3.6.5/lib/python3.6/asyncore.py", line 123, in readwrite obj.handle_error() ; File "/usr/local/python3.6.5/lib/python3.6/asyncore.py", line 108, in readwrite obj.handle_read_event() ; File "/usr/local/python3.6.5/lib/python3.6/asyncore.py", line 423, in handle_read_event self.handle_read() ; File "/home/calix/.local/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read self._cbFun(self, transportAddress, incomingMessage) ; File "/home/calix/.local/lib/python3.6/site-packages/pysnmp/carrier/base.py", line 85, in _cbFun self, transportDomain, transportAddress, incomingMessage ; File "/home/calix/.local/lib/python3.6/site-packages/pysnmp/entity/engine.py", line 152, in __receiveMessageCbFun self, transportDomain, transportAddress, wholeMsg ; File "/home/calix/.local/lib/python3.6/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage msgVersion = verdec.decodeMessageVersion(wholeMsg) ; File "/home/calix/.local/lib/python3.6/site-packages/pysnmp/proto/api/verdec.py", line 17, in decodeMessageVersion recursiveFlag=False, substrateFun=lambda a, b, c: (a, b[:c]) ; File "/home/calix/.local/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__ for asn1Object in streamingDecoder: ; File "/home/calix/.local/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 1919, in __iter__ self._substrate, self._asn1Spec, **self._options): ; File "/home/calix/.local/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 1781, in __call__ self, substrateFun, **options): ; File "/home/calix/.local/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder for chunk in substrateFun(asn1Object, substrate, length, options): ;TypeError: <lambda>() takes 3 positional arguments but 4 were given caused by <class 'TypeError'>: <lambda>() takes 3 positional arguments but 4 were given

lextm commented 1 year ago

Duplicate to https://github.com/pyasn1/pyasn1/issues/28

and157 commented 1 year ago

My recommendation if u want a quick fix just install pyasn1 with the version 0.4.8 , this will solve your problem

ashhhi commented 1 year ago

My recommendation if u want a quick fix just install pyasn1 with the version 0.4.8 , this will solve your problem

Thanks!Solved

lextm commented 1 year ago

@shijunshen Please close this issue if you feel the issue is resolved.

This repo lost its original owner, so now if issue creators like you don't close issues yourselves, none of them can be closed otherwise.

Read #429 to learn more.

wayne-guan2021 commented 1 year ago

It is helpful for me, my pyasn1 version was 0.5.0, after downgrade to 0.4.8, the issue was fixed, thanks.