libusb1.py timeout error using BlinkStickNano

Hello,

i received two BlinkStick Nano and would like to use them for messenger notification.
It works very well, but but after some time (sometimes some seconds, sometimes two minutes) of blinking i got an error message. Libusb1.py report an timeout error. I could reduce the error generation python code to the following lines.

from blinkstick import blinkstick

for bstick in blinkstick.find_all():
    bstick.blink(index=0, hex='#101010', repeats=20000, delay=500)

The error message is:

    Traceback (most recent call last):
  File "/home/marco/Desktop/blink2.py", line 16, in <module>
    bstick.blink(index=0, hex='#101010', repeats=20000, delay=500)
  File "/usr/lib/python2.7/site-packages/blinkstick/blinkstick.py", line 689, in blink
    self.set_color(channel=channel, index=index)
  File "/usr/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 "/usr/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 "/usr/lib/python2.7/site-packages/usb/core.py", line 711, in ctrl_transfer
    self.__get_timeout(timeout)
  File "/usr/lib/python2.7/site-packages/usb/backend/libusb1.py", line 836, in ctrl_transfer
    timeout))
  File "/usr/lib/python2.7/site-packages/usb/backend/libusb1.py", line 571, in _check
    raise USBError(_str_error[ret], ret, _libusb_errno[ret])
USBError: [Errno 5] Input/output error

My system:
Manjaro linux 17.0.5, kernel 4.13.2 x64
python 2.7.12
pyusb (1.0.0b1)
BlinkStick (1.1.8)

Blinkstick was installed via python pip.
Running the following command in a terminal, does not produces an error.

blinkstick --set-color=red --blink --repeats=10000 --delay=500

Can somebody help?

Regards!

Is BlinkStick still functioning after you get the error?

The BlinkStick stops blinking with static light on or off, but is still working after a restart of the script.

Add a time.sleep(0.2). In fact you have 2 nanos you need this to avoid sending the data too fast to the devices.

for bstick in blinkstick.find_all():
    bstick.blink(index=0, hex='#101010', repeats=20000, delay=500)
    time.sleep(0.2)

I use only 1 Stick, so adding time.sleep(0.2) has no effect. I recognized, on on-board USB 2.0 the error show only sometimes and with a USB3.0-Hub it works fine. If i use the on-board USB3.0 port it generates the error. I use the USB-Hub now and blinking works for one hour without an error.

In the meantime i even cleaned the connecting pins of the BlinkStick. It was new, maybe some production residues are removed now and the electric connection is increased.

Thank you for your help, maybe it’s a problem with USB3.0 and pyusb. During the Blinkstick setup via pip there was a message that pyusb will be removed or replaced in future.

Regards.