„usb.core importieren“ funktioniert in Python/PyUSB nichtPython

Python-Programme
Guest
 „usb.core importieren“ funktioniert in Python/PyUSB nicht

Post by Guest »

Ich folge dem Tutorial Programmieren mit PyUSB 1.0.
Ich verwende Windows XP SP3.
Meine Python-Version ist 2.7 und ich habe die Datei pyusb-1.0.0-a1.zip heruntergeladen und installiert.
Und libusb-win32-bin-1.2.4.0.zip.

Code: Select all

import usb
Das funktioniert gut, aber

Code: Select all

import usb.core
Das funktioniert überhaupt nicht. Die Fehlermeldung lautet

Code: Select all

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
PS:
"vom USB-Importkern"
das macht

Code: Select all

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
Der vollständige Quellcode ist hier

Code: Select all

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 configuration. Without any arguments,
# the first configuration will be the active one
dev.set_configuration()

# Get an endpoint instance
ep = usb.util.find_descriptor(
dev.get_interface_altsetting(), # The 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)

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post