Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatible 'bytes' types in pyusb.py and reader.py (python 2.x exception after printing) #139

Open
madeinaus opened this issue Mar 23, 2023 · 0 comments

Comments

@madeinaus
Copy link

reader.py returns a response of type 'bytes'. backends\pyusb.py then coerces it to type 'bytes'. On python 3, this has no effect: it is a null operation. But on python 2, the two 'bytes' types are different, because they have been declared differently in the two files.

Unfortunately, the old 'bytes' type is not recognized by the new 'bytes' type, and reader.py gets

a bytes collection of the string character representation of the repr of the data, b'array ....
61 72 72 61 ...

rather than

a bytes collection of the data.


To make the two parts of the program match, in backends\pyusb.py, include the line

from builtins import bytes

or, modify the existing import of builtin str:
from builtins import str, bytes

As the documentation notes, use of python 2 does not prevent printing. This bug just creates a meaningless exception after the end of every printer operation, when bother_ql tries to analyze the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant