# Python gives errors on even the most basic script

**URL:** <https://forums.blinkstick.com/t/python-gives-errors-on-even-the-most-basic-script/470>\
**Category:** Support\
**Created:** [April 2, 2016, 10:51am UTC](https://forums.blinkstick.com/t/python-gives-errors-on-even-the-most-basic-script/470 "2016-04-02T10:51:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidanalexander100](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/a/e274bd/32.png) [@aidanalexander100](https://forums.blinkstick.com/u/aidanalexander100)\
**Post date:** [April 2, 2016, 10:51am UTC](https://forums.blinkstick.com/t/python-gives-errors-on-even-the-most-basic-script/470/1 "2016-04-02T10:51:31Z")

</div>

I thought i’d try to use python to control a blinkstick flex, but even the sample code is throwing errors for me and I can’t for the life of my work it out.

I’m attempting to run:

"from blinkstick import blinkstick

bstick = blinkstick.find\_first()

bstick.set\_color(channel=0, index=12, name=“red”)"

and it throw these errors in idle:

“Traceback (most recent call last):  
File “E:\Documents\Aidan’s\Python Scripts\LED\blinkstick v1.py”, line 5, in   
bstick.set\_color(channel=0, index=12, name=“red”)  
File “D:\Users\Aidan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\blinkstick\blinkstick.py”, line 341, in set\_color  
self.\_usb\_ctrl\_transfer(0x20, 0x9, report\_id, 0, control\_string)  
File “D:\Users\Aidan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\blinkstick\blinkstick.py”, line 226, in \_usb\_ctrl\_transfer  
data = (c\_ubyte \* len(data\_or\_wLength))(_[c\_ubyte(ord©) for c in data\_or\_wLength])  
File “D:\Users\Aidan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\blinkstick\blinkstick.py”, line 226, in   
data = (c\_ubyte \* len(data\_or\_wLength))(_[c\_ubyte(ord©) for c in data\_or\_wLength])  
TypeError: ord() expected string of length 1, but int found”

Any ideas? Am I missing something? I have installed blinkstick module as when I type “import blinkstick” I don’t get any errors.

Thanks

---

<div class="post-metadata">

**Author:** ![aidanalexander100](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/a/e274bd/32.png) [@aidanalexander100](https://forums.blinkstick.com/u/aidanalexander100)\
**Post date:** [April 2, 2016, 11:08am UTC](https://forums.blinkstick.com/t/python-gives-errors-on-even-the-most-basic-script/470/2 "2016-04-02T11:08:41Z")

</div>

I just installed python 2 and its working now. Wasn’t aware it was python 2 only! how do i delete this thread?

---

<div class="post-metadata">

**Author:** ![p0ke](https://forums.blinkstick.com/user_avatar/forums.blinkstick.com/p0ke/32/14_2.png) [@p0ke](https://forums.blinkstick.com/u/p0ke)\
**Post date:** [April 2, 2016, 3:41pm UTC](https://forums.blinkstick.com/t/python-gives-errors-on-even-the-most-basic-script/470/3 "2016-04-02T15:41:37Z")

</div>

You cannot delete the thread, but it´s good for documentation for the next one searching for this kind of problem.
