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

Space problems with Python 2.7 #9

Closed
semaf opened this issue May 25, 2019 · 6 comments
Closed

Space problems with Python 2.7 #9

semaf opened this issue May 25, 2019 · 6 comments

Comments

@semaf
Copy link

semaf commented May 25, 2019

Hey,

Just want to inform you that the output of the text "Hello World" is "HelloäWorld".

@jnweiger
Copy link
Owner

Thanks for the report, it works correctly for me with python-3.6.7 both pyhidapi and usb.core
Do you have more details? Linux system, python version, installed pyhidapi or usb.core modules?

@semaf
Copy link
Author

semaf commented May 25, 2019

PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"

Python 2.7
pyhidapi (0.0.2)
pyusb (1.0.0)
python-usb (1.0.0-1)

Seems that I am facing also with caching problems. Is not forwarding always the new text.

@jnweiger
Copy link
Owner

pyhidapi sees not so relible. I added a patch today to make it better. You may also want to try to disable loading of pyhidapi. Either by uninstalling or by misspelling it in the script, then it will fall back to usb.core.

I wonder why python 2.7 works for you at all. I believe one of the latest patches killed the compatibility. This also needs fixing.

@semaf
Copy link
Author

semaf commented May 26, 2019

Tested without pyhidapi or usb.core has same result. Installed Python 3.6 solved it.

@semaf semaf changed the title Space problems Space problems with Python 2.7 May 26, 2019
@jnweiger
Copy link
Owner

Using pyhidapi with python-2.7 explodes for me like this:

Traceback (most recent call last):
  File "led-badge-11x44.py", line 466, in <module>
    pyhidapi.hid_write(dev, buf)
  File "/usr/local/lib/python2.7/dist-packages/pyhidapi/pyhidapi.py", line 638, in hid_write
    buf[n] = data[n]
TypeError: one character string expected

Where data[n] is a plain integer, oh well, it wants a char. that is bad.
Workaround: with pyhton-2.7 we always use usb.core

@jnweiger
Copy link
Owner

the original issue was caused by python-2.7 interpreting our charmap as ascii-bytes. We have to prefix the strings here with u"" to make them python-2.7 compatible.

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

2 participants