Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1584

Python • Re: Python module hangs, keeping script from crashing

$
0
0
The hangs are still few and far between, with the same symptoms. Another happened recently.

Is there a way to have a watchdog inside Python to watch relevant parts of the MQTT client? If so, which part?

Code:

Sep 22 19:34:01 pi aht20: /usr/local/bin/aht20-humidity-temperature-to-mqtt-V1.py:91: DeprecationWarning: ssl.SSLContext() without protocol argument is deprecated.Sep 22 19:34:01 pi aht20:   tls_ctx = ssl.SSLContext()Sep 22 19:34:01 pi aht20: /usr/local/bin/aht20-humidity-temperature-to-mqtt-V1.py:91: DeprecationWarning: ssl.PROTOCOL_TLS is deprecatedSep 22 19:34:01 pi aht20:   tls_ctx = ssl.SSLContext()Sep 23 03:30:00 pi aht20: Exception in thread Thread-2 (_thread_main):Sep 23 03:30:00 pi aht20: Traceback (most recent call last):Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_innerSep 23 03:30:00 pi aht20:     self.run()Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3.11/threading.py", line 975, in runSep 23 03:30:00 pi aht20:     self._target(*self._args, **self._kwargs)Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 3591, in _thread_mainSep 23 03:30:00 pi aht20:     self.loop_forever(retry_first_connection=True)Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1756, in loop_foreverSep 23 03:30:00 pi aht20:     rc = self._loop(timeout)Sep 23 03:30:00 pi aht20:          ^^^^^^^^^^^^^^^^^^^Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1164, in _loopSep 23 03:30:00 pi aht20:     rc = self.loop_read()Sep 23 03:30:00 pi aht20:          ^^^^^^^^^^^^^^^^Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1556, in loop_readSep 23 03:30:00 pi aht20:     rc = self._packet_read()Sep 23 03:30:00 pi aht20:          ^^^^^^^^^^^^^^^^^^^Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 2389, in _packet_readSep 23 03:30:00 pi aht20:     byte = self._sock_recv(1)Sep 23 03:30:00 pi aht20:            ^^^^^^^^^^^^^^^^^^Sep 23 03:30:00 pi aht20:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 640, in _sock_recvSep 23 03:30:00 pi aht20:     return self._sock.recv(bufsize)Sep 23 03:30:00 pi aht20:            ^^^^^^^^^^^^^^^Sep 23 03:30:00 pi aht20: AttributeError: 'NoneType' object has no attribute 'recv'Sep 23 12:58:14 pi systemd[1]: Stopping aht20-humidity-temperature-to-mqtt-V1.service - AHT20 Temperature and Humidity to MQTT publisher...

Statistics: Posted by tpyo kingg — Tue Sep 23, 2025 10:10 am



Viewing all articles
Browse latest Browse all 1584

Trending Articles