Skip to content

Commit 0bf9013

Browse files
author
Dadr
committed
Update shutdown.py
1 parent b6d2053 commit 0bf9013

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/shutdown.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ def run(self):
3838
# Shutdown can be initated from GPIO26
3939
poller = select.poll()
4040
try:
41-
with open('/sys/class/gpio/export', 'wb') as f:
41+
with open('/sys/class/gpio/export', 'w') as f:
4242
f.write('%d' % self.gpio)
4343
except Exception:
4444
# Usually it means we ran this before
4545
pass
4646
try:
47-
with open('/sys/class/gpio/gpio%d/direction' % self.gpio, 'wb') as f:
47+
with open('/sys/class/gpio/gpio%d/direction' % self.gpio, 'w') as f:
4848
f.write('in')
4949
except Exception:
5050
logging.warn('Either no GPIO subsystem or no access')
5151
return
52-
with open('/sys/class/gpio/gpio%d/edge' % self.gpio, 'wb') as f:
52+
with open('/sys/class/gpio/gpio%d/edge' % self.gpio, 'w') as f:
5353
f.write('both')
54-
with open('/sys/class/gpio/gpio%d/active_low' % self.gpio, 'wb') as f:
54+
with open('/sys/class/gpio/gpio%d/active_low' % self.gpio, 'w') as f:
5555
f.write('1')
56-
with open('/sys/class/gpio/gpio%d/value' % self.gpio, 'rb') as f:
56+
with open('/sys/class/gpio/gpio%d/value' % self.gpio, 'r') as f:
5757
f.read()
5858
poller.register(f, select.POLLPRI)
5959
poller.register(self.server, select.POLLHUP)

0 commit comments

Comments
 (0)