Skip to content

Commit 741c1b2

Browse files
authored
Merge pull request #212 from dplanella/patch-4
Encoder: fix Python 3 compatibility
2 parents 773f9bd + 6909243 commit 741c1b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Adafruit_BBIO/Encoder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import logging
66
import itertools
7-
import sysfs
7+
from .sysfs import Node
88
import platform
99

1010
(major, minor, patch) = platform.release().split("-")[0].split(".")
@@ -47,7 +47,7 @@ def fromdict(cls, d):
4747
'''Creates a class instance from a dictionary'''
4848

4949
allowed = ('channel', 'pin_A', 'pin_B', 'sys_path')
50-
df = {k: v for k, v in d.iteritems() if k in allowed}
50+
df = {k: v for k, v in d.items() if k in allowed}
5151
return cls(**df)
5252

5353
def __init__(self, channel, pin_A, pin_B, sys_path):
@@ -72,7 +72,7 @@ def __init__(self, channel, pin_A, pin_B, sys_path):
7272
self.pin_A = pin_A
7373
self.pin_B = pin_B
7474
self.sys_path = sys_path
75-
self.node = sysfs.Node(sys_path)
75+
self.node = Node(sys_path)
7676

7777

7878
class RotaryEncoder(object):

0 commit comments

Comments
 (0)