Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError #38

Open
rowdy15 opened this issue Jan 18, 2024 · 1 comment
Open

TypeError #38

rowdy15 opened this issue Jan 18, 2024 · 1 comment

Comments

@rowdy15
Copy link

rowdy15 commented Jan 18, 2024

I am getting the following error when I run the code.

`You may need to check the following in the printer's configuration:

  • SNMP service is enabled (for fetching model and versions)
  • FTP service is enabled (for uploading firmware)
  • an administrator password is set (for connecting to FTP)
    Press Ctrl-C to exit or Enter to continue...
    Getting SNMP data from printer at 192.168.1.46...
    Traceback (most recent call last):
    File "/usr/lib/python3.11/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 45, in runDispatcher
    loop(timeout or self.getTimerResolution(),
    File "/usr/lib/python3.11/asyncore.py", line 212, in loop
    poll_fun(timeout, map)
    File "/usr/lib/python3.11/asyncore.py", line 193, in poll2
    readwrite(obj, flags)
    File "/usr/lib/python3.11/asyncore.py", line 128, in readwrite
    obj.handle_error()
    File "/usr/lib/python3.11/asyncore.py", line 113, in readwrite
    obj.handle_read_event()
    File "/usr/lib/python3.11/asyncore.py", line 425, in handle_read_event
    self.handle_read()
    File "/usr/lib/python3.11/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read
    self._cbFun(self, transportAddress, incomingMessage)
    File "/usr/lib/python3.11/site-packages/pysnmp/carrier/base.py", line 84, in _cbFun
    self.__recvCallables[recvId](
    File "/usr/lib/python3.11/site-packages/pysnmp/entity/engine.py", line 151, in __receiveMessageCbFun
    self.msgAndPduDsp.receiveMessage(
    File "/usr/lib/python3.11/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage
    msgVersion = verdec.decodeMessageVersion(wholeMsg)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/pysnmp/proto/api/verdec.py", line 15, in decodeMessageVersion
    seq, wholeMsg = decoder.decode(
    ^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in call
    for asn1Object in streamingDecoder:
    File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 1918, in iter
    for asn1Object in self._singleItemDecoder(
    File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 1778, in call
    for value in concreteDecoder.valueDecoder(
    File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder
    for chunk in substrateFun(asn1Object, substrate, length, options):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: decodeMessageVersion..() takes 3 positional arguments but 4 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/sam/Downloads/oh-brother-master/oh-brother-master/./oh-brother.py", line 95, in
error, status, index, table = cg.nextCmd(
^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 214, in nextCmd
for (errorIndication,
File "/usr/lib/python3.11/site-packages/pysnmp/hlapi/asyncore/sync/cmdgen.py", line 362, in nextCmd
snmpEngine.transportDispatcher.runDispatcher()
File "/usr/lib/python3.11/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 "/usr/lib/python3.11/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 45, in runDispatcher
loop(timeout or self.getTimerResolution(),
; File "/usr/lib/python3.11/asyncore.py", line 212, in loop
poll_fun(timeout, map)
; File "/usr/lib/python3.11/asyncore.py", line 193, in poll2
readwrite(obj, flags)
; File "/usr/lib/python3.11/asyncore.py", line 128, in readwrite
obj.handle_error()
; File "/usr/lib/python3.11/asyncore.py", line 113, in readwrite
obj.handle_read_event()
; File "/usr/lib/python3.11/asyncore.py", line 425, in handle_read_event
self.handle_read()
; File "/usr/lib/python3.11/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read
self._cbFun(self, transportAddress, incomingMessage)
; File "/usr/lib/python3.11/site-packages/pysnmp/carrier/base.py", line 84, in _cbFun
self.__recvCallables[recvId](
; File "/usr/lib/python3.11/site-packages/pysnmp/entity/engine.py", line 151, in __receiveMessageCbFun
self.msgAndPduDsp.receiveMessage(
; File "/usr/lib/python3.11/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage
msgVersion = verdec.decodeMessageVersion(wholeMsg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
; File "/usr/lib/python3.11/site-packages/pysnmp/proto/api/verdec.py", line 15, in decodeMessageVersion
seq, wholeMsg = decoder.decode(
^^^^^^^^^^^^^^^
; File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in call
for asn1Object in streamingDecoder:
; File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 1918, in iter
for asn1Object in self._singleItemDecoder(
; File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 1778, in call
for value in concreteDecoder.valueDecoder(
; File "/usr/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder
for chunk in substrateFun(asn1Object, substrate, length, options):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;TypeError: decodeMessageVersion..() takes 3 positional arguments but 4 were given
caused by <class 'TypeError'>: decodeMessageVersion..() takes 3 positional arguments but 4 were given
[sam@LinuxDesktopPC oh-brother-master]$ yay python3-pysnmp4
`

what could be the problem?

@thechickenmoo
Copy link

thechickenmoo commented Mar 21, 2024

Same issue with an MFC-8890DW. It seems to be having trouble decoding the response from SNMP?

Edit:
Further googling, it looks like there was a version change in pysnmp that caused issues for scripts. I was able to install an older version (4.4.8) that worked for this purpose in a "venv" of python that allowed it to run just fine.
I'm running on Manjaro (Arch based) and they don't really keep packages of older versions.

The specific commands I ran (just in case they help somebody else):
python -m venv /home/user1/Documents/Oh\ Brother (I already had an "Oh Brother" folder set aside, so it made sense to just do it there.)
cd /home/user1/Documents/Oh\ Brother
./bin/pip install "pysnmp==4.4.8"
./bin/python ./oh\ brother.py XXX.XXX.XXX.XXX (use the actual IP and the path where you stuck your venv)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants