From f88425505b85975410c400afc456088b3b2ccf2e Mon Sep 17 00:00:00 2001 From: 0x07CB <83157348+0x07CB@users.noreply.github.com> Date: Sat, 19 Oct 2024 23:56:54 +0200 Subject: [PATCH] Update dht11.py In Python, simply using raise outside of an except block is not valid and results in the error RuntimeError: No active exception to reraise. --- EXAMPLES/Python/DHT11_SENSOR/dht11.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXAMPLES/Python/DHT11_SENSOR/dht11.py b/EXAMPLES/Python/DHT11_SENSOR/dht11.py index 455ad2a..98307b7 100644 --- a/EXAMPLES/Python/DHT11_SENSOR/dht11.py +++ b/EXAMPLES/Python/DHT11_SENSOR/dht11.py @@ -88,7 +88,7 @@ class DHT11(object): total = self.humidity + self.temperature # is checksum ok ? if not (total & 255) == self.checksum: - raise + raise ValueError("Checksum incorrect") elif 16 <= self.bit < 24: # in temperature byte self.temperature = (self.temperature << 1) + val elif 0 <= self.bit < 8: # in humidity byte