From: Xiaofan C. <xia...@gm...> - 2013-01-22 06:09:38
|
On Tue, Jan 22, 2013 at 1:50 PM, Xiaofan Chen <xia...@gm...> wrote: > On Thu, Jan 10, 2013 at 3:43 PM, Cybergibbons <cyb...@gm...> wrote: >> I have been trying to use PyUSB for a few hours using Python 3.3 under >> Windows 7 and was getting issues with "Cannot find backend". >> ctypes.util.find_library was failing to find the DLL, yet if I stepped >> through the code, it would find the DLL. Even once this was resolved, a >> problem occurred in the init code. > > Seem to be okay for me. I just installed Python 3.3 and pywin32 > and I can find the device with Python 3.3. > > Which backend are you using? I am trying out the libusb-1.0 > backend and it seems to work. The device is ST-Link V2 and > it uses WinUSB driver. > > Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (In > tel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import usb.core >>>> import usb.util >>>> dev = usb.core.find(idVendor=0x0483, idProduct=0x3748) >>>> dev > <usb.core.Device object at 0x00CF9E90> >>>> Hmm, I was putting libusb-1.0.dll under C:\Python33 for the above testing. Once I move it to C:\Windows\System32, I will have the same problem as you. Python 2.7 is okay. Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (In tel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import usb.core >>> import usb.util >>> dev = usb.core.find(idVendor=0x0483, idProduct=0x3748) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python33\lib\site-packages\usb\core.py", line 861, in find raise ValueError('No backend available') ValueError: No backend available Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import usb.core >>> import usb.util >>> dev = usb.core.find(idVendor=0x0483, idProduct=0x3748) >>> dev <usb.core.Device object at 0x00C345B0> >>> So it seems to me maybe the DLL finding method in Python 3.3 is a bit different. Google seems to suggest this is a Python 3.3 bug. http://bugs.python.org/issue16283 Title: ctypes.util.find_library does not find all DLLs anymore Type: behavior Stage: Components: ctypes Versions: Python 3.3 -- Xiaofan |