adafruit / Adafruit_AMG88xx_python

AMG88xx Grid-EYE
MIT License
16 stars 21 forks source link

Python 3 compatibility - bitfield #2

Closed martinohanlon closed 6 years ago

martinohanlon commented 6 years ago

There is an error when using this library with Python 3

Traceback (most recent call last):
  File "examples/pixels_test.py", line 40, in <module>
    sensor = Adafruit_AMG88xx()
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_AMG88xx/Adafruit_AMG88xx.py", line 91, in __init__
    self._pctl = Adafruit_bitfield([('PCTL', 8)])
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_bitfield/Adafruit_bitfield.py", line 8, in __init__
    for key, value in self._structure.iteritems():
AttributeError: 'collections.OrderedDict' object has no attribute 'iteritems'

The error originates from Adafruit-bitfield. I was going to fix and provide a PR but I cant find the repo - pypi points to https://github.com/adafruit/Adafruit_bitfield_python but it doesn't exist.

deanm1278 commented 6 years ago

@martinohanlon oops the repo was set to private. https://github.com/adafruit/Adafruit_bitfield_python is now public. Looks like iteritems was removed in python 3, feel free to fix and PR if you'd like! otherwise I will fix soon. Thanks!

martinohanlon commented 6 years ago

PR submitted https://github.com/adafruit/Adafruit_bitfield_python/pull/1.

You will also have to modify setup.py to state the new version is required when its available on pypi. :)

deanm1278 commented 6 years ago

ok @martinohanlon all merged and verified working, thanks!

martinohanlon commented 6 years ago

:+1: