Skip to content

Nested exception: "During handling of the above exception, another exception occurred" #248

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

Open
dglaude opened this issue Apr 13, 2025 · 4 comments

Comments

@dglaude
Copy link

dglaude commented Apr 13, 2025

I have a project where a PyPortal read from MQTT and display status.

Traceback (most recent call last):
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1036, in _wait_for_msg
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1124, in _sock_exact_recv
  File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 171, in recv_into
  File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 198, in _available
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 892, in socket_available
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 431, in _send_command_get_response
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 398, in _wait_response_cmd
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 377, in _wait_spi_char
TimeoutError: Timed out waiting for SPI char

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "code.py", line 247, in <module>
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1011, in loop
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1041, in _wait_for_msg
TypeError: function takes 3 positional arguments but 2 were given
]0;🐍1041@adafruit_minimqtt/adafruit_minim TypeError | 9.2.7\
Code done running.

My code seems to not responsible for this error:

while True:
    try:
        mqtt_client.loop(timeout=1)  # Poll the message queue <= Line 247
    except (ValueError, RuntimeError, MQTT.MMQTTException) as e:
        print("Failed to get data, retrying.")
        text_area[0].text = "Failed to get data, retrying."
        mqtt_client.reconnect()  # continue
@dglaude
Copy link
Author

dglaude commented Apr 13, 2025

Initial investigation from Neradoc on discord:

yep the line is wrong, it needs a ("Some message") argument to the MMQTTException

I mean that line, that raises the error:

now the real error underneath is the airlift SPI timing out
but that's a different story

@dglaude
Copy link
Author

dglaude commented Apr 13, 2025

Versions I am using:

Found device pyportal at E:\, running CircuitPython 9.2.7.
adafruit_connection_manager==3.1.3
adafruit_ticks==1.1.2
adafruit_minimqtt==8.0.0
adafruit_progressbar==2.3.16
adafruit_bitmap_font==2.3.0
adafruit_display_text==3.2.4
adafruit_led_animation==2.11.1

@justmobilize
Copy link
Collaborator

What nina firmware are you using?

If it's not current,l (v2.0.0) I would recommend updating it first.

Not sure? This code will print it in the REPL: https://learn.adafruit.com/adafruit-pyportal/internet-connect

Upgrading: https://learn.adafruit.com/upgrading-esp32-firmware/upgrade-all-in-one-esp32-airlift-firmware

@dglaude
Copy link
Author

dglaude commented Apr 13, 2025

Thanks @justmobilize , I was using 1.7.5 and I now run the latest.
It does not change much for me as I previously applied a fix based on @Neradoc analyze for line 1041 of adafruit_minimqtt.py:

               raise MMQTTException("Please insert meaningfull message here.") from error

And that already solved the problem for me.

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