2012/11/12 Stefano Di Martino <stefan...@gmx.net>: > Hi, > I tested it under Linux, but there was no problem. But I tested it on an > another Computer with Python 2.7 instead of 2.5. > The other thing is, I can't reproduce this problem, with C. > > I made a simple stress test with python: > > This works: > > for i in range(100): > usb.core.find(find_all=True) > > This don't work! > > for i in range(100): > device_list = usb.core.find(find_all=True) > > Two lines of code (besides the import), nothing more... > The error message: > > "usb.core.USBError: [Errno 19] No such device (it may have been disconnected)" > > Where it happens: > > class _DevIterator(object): > def __init__(self): > self.dev_list = POINTER(c_void_p)() > self.num_devs = _check(_lib.libusb_get_device_list( > None, > byref(self.dev_list)) > ).value # Here! > > > def _check(retval): > if isinstance(retval, int): > retval = c_int(retval) > if isinstance(retval, c_int): > if retval.value < 0: > from usb.core import USBError > ret = retval.value > raise USBError(_str_error[ret], ret, _libusb_errno[ret]) # Here > the Exception rises. > return retval > > > My simple C code: > > for(i = 0; i < 100; i++) { > cnt = libusb_get_device_list(NULL, &devs); > if (cnt < 0) > return (int) cnt; > if (i < 99) > libusb_free_device_list(devs, 1); > } >
What happens if you don't call libusb_free_device_list? -- Best Regards, Wander Lairson Costa ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users