Я следую этому руководству (http://pyusb.sourceforge.net/docs/1.0/tutorial.html)
Я использую Windows XP SP3,
мой версия Python 2.7, я скачал и установил pyusb-1.0.0-a1.zip
и libusb-win32-bin-1.2.4.0.zip
import usb
Это работает нормально, но
import usb.core
Это вообще не работает. В сообщении об ошибке говорится
Traceback (most recent call last):
File "D:\py\usb.py", line 1, in
from usb import core
File "D:\py\usb.py", line 1, in
from usb import core
ImportError: cannot import name core
p.s.
"из ядра импорта USB"
это делает
Traceback (most recent call last):
File "D:\py\usb.py", line 1, in
from usb import core
File "D:\py\usb.py", line 1, in
from usb import core
ImportError: cannot import name core
полный исходный код находится здесь
from usb import core
#find device
dev = usb.core.find(idVendor=0x1516, idProduct=0x8628)
#found?
if dev is None :
raise ValueError('device not found')
#set the active config. with no args, the first config will be the active one
dev.set_configuration()
#get an end point instance
ep = usb.util.find_descriptor(
dev.get_interface_altsetting(), #first interface
#match the first Out Endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
assert ep is not None
while(1):
ep.write(0x5553424350DDBC880000000000000600000000000000000000000000000000)
ep.write(0x5553425350ddbc880000000000)
Подробнее здесь: https://stackoverflow.com/questions/621 ... oesnt-work