blink1 icon indicating copy to clipboard operation
blink1 copied to clipboard

Could not find an attached Blink(1)

Open SasaKaranovic opened this issue 11 years ago • 9 comments

I'm trying to run your Blink1 Python (pypi) example and get an error that Blink(1) cannot be found.

I have Blink(1) mk2 attached to my pc (running Win7 and Python 3.2.4) and I can see Blink(1) in my device

manager and also control it via Blink1Control.

I tried running python script with Blink1Control turned off, and also with Blink1Control turned on but same results.

I'm attaching screenshot of my script, error and hardware manager list. Screenshot

SasaKaranovic avatar Dec 04 '14 23:12 SasaKaranovic

Hi, I'm not too experienced with Python 3 or Python on Windows. Maybe @salimfadhley can help.

I just tried "python -m pip install blink1" and it installed fine, but when I open up IDLE and try to use the 'blink1' package, I get this error:

>>> from blink1.blink1 import Blink1
>>> b1 = Blink1()
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    b1 = Blink1()
  File "C:\Python34\lib\site-packages\blink1\blink1.py", line 81, in __init__
    self.dev = self.find()
  File "C:\Python34\lib\site-packages\blink1\blink1.py", line 90, in find
    dev = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
  File "C:\Python34\lib\site-packages\usb\core.py", line 1199, in find
    raise ValueError('No backend available')
ValueError: No backend available

Any clues Windows Python experts?

todbot avatar Dec 04 '14 23:12 todbot

Also, @coldkeyboard, what was the exact process you used to install the blink1 Python library?

todbot avatar Dec 05 '14 00:12 todbot

I had the same problems - there are some additional notes in the documentation specifically for Windows users. You have to install additional USB drivers to make PyUSB work. Have you tried that?

On Fri Dec 05 2014 at 00:02:01 Tod E. Kurt [email protected] wrote:

Also, @coldkeyboard https://github.com/coldkeyboard, what was the exact process you used to install the blink1 Python library?

— Reply to this email directly or view it on GitHub https://github.com/todbot/blink1/issues/188#issuecomment-65726489.

salimfadhley avatar Dec 05 '14 00:12 salimfadhley

I used "pip install blink1" from the command prompt.

@salimfadhley What additional driver do I have to install? Could you please provide a link for Win 7 x64 and Python 3.2.4?

SasaKaranovic avatar Dec 05 '14 01:12 SasaKaranovic

Hi Salim,

Which docs? I'm looking at the PyUSB docs at http://walac.github.io/pyusb/ and not seeing anything useful.

todbot avatar Dec 05 '14 01:12 todbot

I reinstalled libusb and attached Blink(1) as libusb-win32-device. Now I can find the device but I get another error.

blink(1) found serial number: Љ Traceback (most recent call last): File "C:\Users\Sale\Desktop\blink.py", line 12, in print("firmware version: " + blink1.get_version()) File "C:\Python34\lib\site-packages\blink1\blink1.py", line 174, in get_version self.write(buf) File "C:\Python34\lib\site-packages\blink1\blink1.py", line 120, in write buf) File "C:\Python34\lib\site-packages\usb\core.py", line 962, in ctrl_transfer self._ctx.managed_claim_interface(self, interface_number) File "C:\Python34\lib\site-packages\usb\core.py", line 146, in managed_claim_interface self.backend.claim_interface(self.handle, i) File "C:\Python34\lib\site-packages\usb\backend\libusb0.py", line 468, in claim_interface _check(_lib.usb_claim_interface(dev_handle, intf)) File "C:\Python34\lib\site-packages\usb\backend\libusb0.py", line 380, in _check raise USBError(errmsg, ret) usb.core.USBError: [Errno None] b'usb_claim_interface: could not claim interface 0, invalid configuration 0'

SasaKaranovic avatar Dec 05 '14 02:12 SasaKaranovic

I have the blink1 Python library working on, by doing these steps:

  1. Install Python 3.4 from python.org
  2. Install blink1 lib (which install PyUSB) by opening up Powershell and typing: C:\Python34\python.exe -m pip install blink1
  3. Install libusb-win32 backend for PyUSB by doing: a. Download the libusb-win32-bin zip from http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download b. Plug in the blink(1) c. Unzip and go into the 'bin' directory. Double-click on 'inf-wizard.exe' d. Follow the wizard, choose the blink(1) device from the list e. Save the file as requested and click "Install Now" to install it
  4. Try out the blink1 Python library and everything should work.

todbot avatar Dec 05 '14 02:12 todbot

I installed libusb just like you said and python now finds the device but I get the error that I already posted above. Also another problem is when I use lib32, Blink1Control doesn't find the attached device, which is weird :\

I guess I'll have to give up on Python library and do the job with REST... which was the thing I tried to avoid in the first place :\

SasaKaranovic avatar Dec 05 '14 03:12 SasaKaranovic

The other thing you can do is have your python script use the blink1-tool.exe to control the blink1.

todbot avatar Dec 05 '14 05:12 todbot