From 082e6dfd883b0dcbd104a1b457ff6857cd0f45e0 Mon Sep 17 00:00:00 2001 From: Lff5 Date: Thu, 24 Nov 2022 18:11:22 +0200 Subject: [PATCH] fix closing self.open_spi_handles self.open_spi_handles looks like this: {7: 7} calling reversed(self.open_spi_handles) throws: Traceback (most recent call last): File "", line 1, in TypeError: 'dict' object is not reversible --- pipyadc/pipyadc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipyadc/pipyadc.py b/pipyadc/pipyadc.py index c80c76f..8703a4b 100644 --- a/pipyadc/pipyadc.py +++ b/pipyadc/pipyadc.py @@ -187,7 +187,7 @@ def stop(self): def stop_close_all(self): """Close all open pigpio SPI handles and stop pigpio connection """ - for handle in reversed(self.open_spi_handles): + for handle in reversed(list(self.open_spi_handles.values())): logger.debug(f"Closing SPI handle: {handle}") self.pi.spi_close(handle) self.open_spi_handles.clear()