2

I'm trying to reach out and find what USB devices are tied to my computer. I'm going through the "Programming with PyUSB 1.0" tutorial. I can't get anything I'm using there to work, I keep getting a "ValueError: No background available" error. What is missing from my code? I'm on a 64 bit Windows 10 machine. I installed the libusb1 package as well as the pylibusb package.

import usb
import usb.core
import usb.util
import sys

devices = usb.core.find(find_all=True)

sys.stdout.write('There are ' + len(devices) + ' in the system\n.')
Kenster
  • 23,465
  • 21
  • 80
  • 106
Mike
  • 41
  • 1
  • 4

2 Answers2

4

If it's a windows OS you should download the installer from here

If it's Linux, did you install libusb-1.0 or openusb as a backends? If no, you should.

omri_saadon
  • 10,193
  • 7
  • 33
  • 58
  • agree with what @omri said , install libusb1 using __pip install libusb1__ – tom May 24 '17 at 16:25
  • Thank you, I'm running Windows 10. I've followed these solutions, and tried this one too, to no avail. What's the missing link? What do I need to do to get my simple python code to find and use the libusb1 and therefore have a backend? I'm also confused that the pyusb tutorial says you shouldn't need to do this. – Mike May 24 '17 at 17:09
0

Depending on what kind of device you are using and assuming you are on Linux, you may need to setup permissions for your user to read the raw USB device like /dev/ttyUSB0. Check the permissions on your usb device tree, add yourself to the relevant groups and/or setup your udev rules.

user2722968
  • 13,636
  • 2
  • 46
  • 67