# \[Errno 32\] Pipe error

**URL:** <https://forums.blinkstick.com/t/errno-32-pipe-error/1053>\
**Category:** Support\
**Created:** [September 23, 2018, 11:15pm UTC](https://forums.blinkstick.com/t/errno-32-pipe-error/1053 "2018-09-23T23:15:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_K](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/m/e68b1a/32.png) [@Matt\_K](https://forums.blinkstick.com/u/Matt_K)\
**Post date:** [September 23, 2018, 11:15pm UTC](https://forums.blinkstick.com/t/errno-32-pipe-error/1053/1 "2018-09-23T23:15:44Z")

</div>

Hi,

I’ve been trying to write some basic Python code for a Blinkstick Flex and keep getting _usb.core.USBError: [Errno 32] Pipe error_ but only about half the time I run the code. I am aware of the 20ms delay and have my code set currently for 80ms but have tried a number of different values. The Blinkstick Flex is one of three blinkstick products plugged into a Raspberry Pi but it is also the only one that is part of this code.

Here is the code (its written terribly…sorry about that):

> from blinkstick import blinkstick  
> import time  
> import random
> 
> bstick = blinkstick.find\_by\_serial(“BS018653-3.1”)
> 
> #Rainbow  
> #Red  
> bstick.set\_color(channel=0, index=0, red=255,green=0,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=1, red=255,green=0,blue=0)  
> time.sleep(.08)  
> #Orange  
> bstick.set\_color(channel=0, index=2, red=255,green=70,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=3, red=255,green=70,blue=0)  
> time.sleep(.08)  
> #Yellow  
> bstick.set\_color(channel=0, index=4, red=255,green=200,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=5, red=255,green=200,blue=0)  
> time.sleep(.08)  
> #Green  
> bstick.set\_color(channel=0, index=6, red=0,green=255,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=7, red=0,green=255,blue=0)  
> time.sleep(.08)  
> #Blue  
> bstick.set\_color(channel=0, index=8, red=0,green=0,blue=255)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=9, red=0,green=0,blue=255)  
> time.sleep(.08)  
> #Indigo  
> bstick.set\_color(channel=0, index=10, red=75,green=0,blue=130)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=11, red=75,green=0,blue=130)  
> time.sleep(.08)  
> #Violet  
> bstick.set\_color(channel=0, index=12, red=238,green=70,blue=238)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=13, red=238,green=70,blue=238)  
> time.sleep(.08)
> 
> #White  
> bstick.set\_color(channel=0, index=14, red=255,green=255,blue=255)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=15, red=255,green=255,blue=255)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=16, red=255,green=255,blue=255)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=17, red=255,green=255,blue=255)  
> time.sleep(.08)
> 
> bstick.set\_color(channel=0, index=18, red=238,green=70,blue=238)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=19, red=238,green=70,blue=238)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=20, red=75,green=0,blue=130)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=21, red=75,green=0,blue=130)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=22, red=0,green=0,blue=255)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=23, red=0,green=0,blue=255)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=24, red=0,green=255,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=25, red=0,green=255,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=26, red=255,green=200,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=27, red=255,green=200,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=28, red=255,green=70,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=29, red=255,green=70,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=30, red=255,green=0,blue=0)  
> time.sleep(.08)  
> bstick.set\_color(channel=0, index=31, red=255,green=0,blue=0)  
> time.sleep(.08)

Here is the full error message:

> pi@raspberrypi:~/Desktop/Code $ python blink\_flex.py  
> Traceback (most recent call last):  
> File “blink\_flex.py”, line 98, in   
> bstick.set\_color(channel=0, index=28, red=255,green=70,blue=0)  
> File “/home/pi/.local/lib/python2.7/site-packages/blinkstick/blinkstick.py”, line 341, in set\_color  
> self.\_usb\_ctrl\_transfer(0x20, 0x9, report\_id, 0, control\_string)  
> File “/home/pi/.local/lib/python2.7/site-packages/blinkstick/blinkstick.py”, line 244, in \_usb\_ctrl\_transfer  
> return self.device.ctrl\_transfer(bmRequestType, bRequest, wValue, wIndex, data\_or\_wLength)  
> File “/home/pi/.local/lib/python2.7/site-packages/usb/core.py”, line 711, in ctrl\_transfer  
> self.\_\_get\_timeout(timeout)  
> File “/home/pi/.local/lib/python2.7/site-packages/usb/backend/libusb1.py”, line 836, in ctrl\_transfer  
> timeout))  
> File “/home/pi/.local/lib/python2.7/site-packages/usb/backend/libusb1.py”, line 571, in \_check  
> raise USBError(\_str\_error[ret], ret, \_libusb\_errno[ret])  
> usb.core.USBError: [Errno 32] Pipe error

Am I trying to do something that is blatantly wrong here? This isn’t the actual program I’m trying to write, just a test to see if I could troubleshoot the Flex. This same error is happening anytime I want to change several of the individual LEDs in a given run of a program.

Thank you!

---

<div class="post-metadata">

**Author:** ![arvydas](https://forums.blinkstick.com/user_avatar/forums.blinkstick.com/arvydas/32/242_2.png) [@arvydas](https://forums.blinkstick.com/u/arvydas)\
**Post date:** [September 25, 2018, 8:18am UTC](https://forums.blinkstick.com/t/errno-32-pipe-error/1053/2 "2018-09-25T08:18:24Z")

</div>

A more efficient way is to send LED frames. You can use the BlinkStickPro class for this and here is an example:

> **[arvydas/blinkstick-python](https://github.com/arvydas/blinkstick-python/wiki/BlinkStick-Pro:-Display-analogue-clock-on-16-LED-ring)**
>
> BlinkStick-Pro:-Display-analogue-clock-on-16-LED-ring

With LED frames you would be sending all colors ar the same time. You can also do this with basic bstick class and set\_led\_data function

[https://arvydas.github.io/blinkstick-python/blinkstick.blinkstick.BlinkStick-class.html#set\_led\_data](https://arvydas.github.io/blinkstick-python/blinkstick.blinkstick.BlinkStick-class.html#set_led_data)

Please note that set\_led\_data function accepts an array of bytes in GRB format.

---

<div class="post-metadata">

**Author:** ![Matt\_K](https://forums.blinkstick.com/letter_avatar_proxy/v4/letter/m/e68b1a/32.png) [@Matt\_K](https://forums.blinkstick.com/u/Matt_K)\
**Post date:** [September 30, 2018, 10:18pm UTC](https://forums.blinkstick.com/t/errno-32-pipe-error/1053/3 "2018-09-30T22:18:25Z")

</div>

Thank you! Much easier than the way I was trying to do things. 🙂
