I am quite new to programming and have been trying to run a basic python program using IDLE on Windows 8 as seen on this page (usb device identification) I need to read a USB stick and return the vendor and product Ids (see below)
import usb #import the usb package which contains all the PyUSB modules
busses = usb.busses() #Assign USB busses to a tuple (this is returned from legacy)
for bus in busses:
devices = bus.devices
for dev in devices:
print "Device:", dev.filename
print " idVendor: %d (0x%04x)" % (dev.idVendor, dev.idVendor)
print " idProduct: %d (0x%04x)" % (dev.idProduct, dev.idProduct)
I’ve been using the PyUSB library: Pyusb- 1.0.0.0a2 (http://sourceforge.net/projects/pyusb/)
And the IDLE python text editor version 2.7.8 (https://www.python.org/downloads/)
Similarly to the other page, I keep getting returned a “backend unavailable” error. My folder structure is as follows (sorry about the excessive underscoring, they represent subfolders):
- 27-11-14 (the folder containing my actual program: “27-11-14_busses.py”)
- _________Build((came with the downloaded Pyusb-1.0.0.0a2))
- _________docs (came with the downloaded Pyusb-1.0.0.0a2)
- _________usb (came with the downloaded Pyusb-1.0.0.0a2)
- __________________backend (which contains backends: libusb0, libusb1 and openusb)
- _________DLLs
- _________Doc
- _________etc
- _________include
- _________Lib
- _________Libs
- _________tcl
- _________tests
- _________Tools
The problem seems to occur inside a file called “core.py” (in “usb” folder) for a user defined function called “find” This contains code for importing 3 different backends All 3 of these are inside my backend folder, but for some reason the program can’t find them
Can anyone see what the problem might be? Is my folder structure incorrect?