sedrubal / brother_printer_fwupd

Script to update the firmware of some Brother printers
https://pypi.org/project/brother_printer_fwupd/
GNU General Public License v3.0
30 stars 5 forks source link

[bug] getting stack-trace after selecting brother printer for update #17

Closed typoworx-de closed 9 months ago

typoworx-de commented 10 months ago

I'm getting this stack-tracke after installing the script using pip, running it and selecting my brother MFC9332CDW Printer (which was found).

I'm running ubuntu 22.04 (jammy).

[i] Querying printer info via SNMP.
[!] poll error: Traceback (most recent call last):
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 45, in runDispatcher
    loop(timeout or self.getTimerResolution(),
;  File "/usr/lib/python3.10/asyncore.py", line 214, in loop
    poll_fun(timeout, map)
;  File "/usr/lib/python3.10/asyncore.py", line 195, in poll2
    readwrite(obj, flags)
;  File "/usr/lib/python3.10/asyncore.py", line 130, in readwrite
    obj.handle_error()
;  File "/usr/lib/python3.10/asyncore.py", line 115, in readwrite
    obj.handle_read_event()
;  File "/usr/lib/python3.10/asyncore.py", line 427, in handle_read_event
    self.handle_read()
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read
    self._cbFun(self, transportAddress, incomingMessage)
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/base.py", line 84, in _cbFun
    self.__recvCallables[recvId](
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/entity/engine.py", line 151, in __receiveMessageCbFun
    self.msgAndPduDsp.receiveMessage(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage
    msgVersion = verdec.decodeMessageVersion(wholeMsg)
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/proto/api/verdec.py", line 15, in decodeMessageVersion
    seq, wholeMsg = decoder.decode(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__
    for asn1Object in streamingDecoder:
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1918, in __iter__
    for asn1Object in self._singleItemDecoder(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1778, in __call__
    for value in concreteDecoder.valueDecoder(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder
    for chunk in substrateFun(asn1Object, substrate, length, options):
;TypeError: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
caused by <class 'TypeError'>: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
[!] This might be a bug.
Dragunovam commented 9 months ago

I'm getting this stack-tracke after installing the script using pip, running it and selecting my brother MFC9332CDW Printer (which was found).

I'm running ubuntu 22.04 (jammy).

[i] Querying printer info via SNMP.
[!] poll error: Traceback (most recent call last):
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 45, in runDispatcher
    loop(timeout or self.getTimerResolution(),
;  File "/usr/lib/python3.10/asyncore.py", line 214, in loop
    poll_fun(timeout, map)
;  File "/usr/lib/python3.10/asyncore.py", line 195, in poll2
    readwrite(obj, flags)
;  File "/usr/lib/python3.10/asyncore.py", line 130, in readwrite
    obj.handle_error()
;  File "/usr/lib/python3.10/asyncore.py", line 115, in readwrite
    obj.handle_read_event()
;  File "/usr/lib/python3.10/asyncore.py", line 427, in handle_read_event
    self.handle_read()
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read
    self._cbFun(self, transportAddress, incomingMessage)
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/base.py", line 84, in _cbFun
    self.__recvCallables[recvId](
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/entity/engine.py", line 151, in __receiveMessageCbFun
    self.msgAndPduDsp.receiveMessage(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage
    msgVersion = verdec.decodeMessageVersion(wholeMsg)
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/proto/api/verdec.py", line 15, in decodeMessageVersion
    seq, wholeMsg = decoder.decode(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__
    for asn1Object in streamingDecoder:
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1918, in __iter__
    for asn1Object in self._singleItemDecoder(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1778, in __call__
    for value in concreteDecoder.valueDecoder(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder
    for chunk in substrateFun(asn1Object, substrate, length, options):
;TypeError: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
caused by <class 'TypeError'>: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
[!] This might be a bug.

This is a dependency issue where PySNMP needs the PyASN1 implementation in python. Installing it in pip or your python virtual environment will do the job: pip install --upgrade pyasn1

sedrubal commented 9 months ago

Thanks for investigating the issue and sorry that you had these problems. If I understand this correctly, we can fix this issue by adding pyasn1 as dependency. I'll verify this and publish an update as soon as I find some free time. Merge requests are welcome ;)

sedrubal commented 9 months ago

I released version 0.5.3. Please report back if the issue still exists.