DancingQuanta / pyusbiss

Python API for USB-ISS Multifunction USB Communications Module
MIT License
2 stars 3 forks source link

Issue with Python3.2 handling of byte arrays #1

Closed dhhagan closed 7 years ago

dhhagan commented 7 years ago

Using Python3.2, upon initialization of the opc.OPCN2 class, an error is thrown due to the way byte arrays are handled in python3 vs python2.

What I Did

TypeError: 'int' does not support the buffer interface

decoded = [struct.unpack('B', response[i + 1])[0] for i in range(0, len(data))]

This is a fairly straightforward fix..I think the bytes need to be sent as arrays...I'll take a look at it tomorrow morning.

NOTE: I was able to get this up and running with Python2.7 without any issues.

DancingQuanta commented 7 years ago

I haven't had time to test on python 3.x and my placement is finished so I do not have the hardware. If you can make this compatible with 3.x that would be great!

On 24 Oct 2016 22:59, "David H Hagan" notifications@github.com wrote:

  • pyusbiss version: 0.1.0
  • Python version: 3.2.3
  • Operating System: Raspbian

Description

Using Python3.2, upon initialization of the opc.OPCN2 class, an error is thrown due to the way byte arrays are handled in python3 vs python2. What I Did

TypeError: 'int' does not support the buffer interface

decoded = [struct.unpack('B', response[i + 1])[0] for i in range(0, len(data))]

This is a fairly straightforward fix..I think the bytes need to be sent as arrays...I'll take a look at it tomorrow morning.

NOTE: I was able to get this up and running with Python2.7 without any issues.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DancingQuanta/pyusbiss/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AIB3VQTQLviNlkyicYh8vSYh_IhG2KA7ks5q3So9gaJpZM4KfVYH .

dhhagan commented 7 years ago

Awesome. I sent a PR a few hours ago that includes the patch!