From 0bf9013c51ecc2dcc62aef41d43cf48ddb03d188 Mon Sep 17 00:00:00 2001 From: Dadr Date: Wed, 24 Feb 2021 12:31:21 -0500 Subject: [PATCH] Update shutdown.py --- modules/shutdown.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/shutdown.py b/modules/shutdown.py index 62bde7a..e2adcf5 100644 --- a/modules/shutdown.py +++ b/modules/shutdown.py @@ -38,22 +38,22 @@ def run(self): # Shutdown can be initated from GPIO26 poller = select.poll() try: - with open('/sys/class/gpio/export', 'wb') as f: + with open('/sys/class/gpio/export', 'w') as f: f.write('%d' % self.gpio) except Exception: # Usually it means we ran this before pass try: - with open('/sys/class/gpio/gpio%d/direction' % self.gpio, 'wb') as f: + with open('/sys/class/gpio/gpio%d/direction' % self.gpio, 'w') as f: f.write('in') except Exception: logging.warn('Either no GPIO subsystem or no access') return - with open('/sys/class/gpio/gpio%d/edge' % self.gpio, 'wb') as f: + with open('/sys/class/gpio/gpio%d/edge' % self.gpio, 'w') as f: f.write('both') - with open('/sys/class/gpio/gpio%d/active_low' % self.gpio, 'wb') as f: + with open('/sys/class/gpio/gpio%d/active_low' % self.gpio, 'w') as f: f.write('1') - with open('/sys/class/gpio/gpio%d/value' % self.gpio, 'rb') as f: + with open('/sys/class/gpio/gpio%d/value' % self.gpio, 'r') as f: f.read() poller.register(f, select.POLLPRI) poller.register(self.server, select.POLLHUP)