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

ord() expected error #69

Open
agogodavid opened this issue Sep 30, 2020 · 2 comments
Open

ord() expected error #69

agogodavid opened this issue Sep 30, 2020 · 2 comments

Comments

@agogodavid
Copy link

agogodavid commented Sep 30, 2020

Error encountered when trying to control BlinkStrip using Python 3 on Windows.

#Import blinkstick module
from blinkstick import blinkstick

#Find the first BlinkStick
bstick = blinkstick.find_first()

#Set the color red on the 12th LED of R channel
bstick.set_color(channel=0, index=12, name="red")
TypeError                                 Traceback (most recent call last)
<ipython-input-91-73997141703b> in <module>
      6 
      7 #Set the color red on the 12th LED of R channel
----> 8 bstick.set_color(channel=0, index=12, name="red")

E:\Anaconda3\lib\site-packages\blinkstick\blinkstick.py in set_color(self, channel, index, red, green, blue, name, hex)
    339 
    340         if self.error_reporting:
--> 341             self._usb_ctrl_transfer(0x20, 0x9, report_id, 0, control_string)
    342         else:
    343             try:

E:\Anaconda3\lib\site-packages\blinkstick\blinkstick.py in _usb_ctrl_transfer(self, bmRequestType, bRequest, wValue, wIndex, data_or_wLength)
    224         if sys.platform == "win32":
    225             if bmRequestType == 0x20:
--> 226                 data = (c_ubyte * len(data_or_wLength))(*[c_ubyte(ord(c)) for c in data_or_wLength])
    227                 data[0] = wValue
    228                 if not self.device.send_feature_report(data):

E:\Anaconda3\lib\site-packages\blinkstick\blinkstick.py in <listcomp>(.0)
    224         if sys.platform == "win32":
    225             if bmRequestType == 0x20:
--> 226                 data = (c_ubyte * len(data_or_wLength))(*[c_ubyte(ord(c)) for c in data_or_wLength])
    227                 data[0] = wValue
    228                 if not self.device.send_feature_report(data):

TypeError: ord() expected string of length 1, but int found


@cwarrencoderedsafety
Copy link

I found that if I removed the ord() portions, following this:
https://stackoverflow.com/questions/30076240/ord-expected-string-of-length-1-but-int-found
from the blinkstick.py file located under python's site-packages, it works. I am using python 3.8.5

@agogodavid
Copy link
Author

This works perfect!
Thanks a bunch!!

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