PyUSB timeout fix

1,930 views
Skip to first unread message

Alex Rodrigues

unread,
Dec 9, 2013, 10:48:37 PM12/9/13
to nxt-p...@googlegroups.com
A few weeks ago I was having problems connecting to an NXT with PyUSB, libusb-win32 and nxt-python. Only today did I figure out the solution and I thought I would put it here in case anybody ever has the same problem.  The first trick was getting libusb-win32 installed properly. This is explained very well here: http://www.youtube.com/watch?v=1nTaI-N0TCs. (Note, however that you do have to manually copy the files that he moves with install.bat)
Once I got libusb-win32 working, I would get the error:
USBError: [Errno None] libusb0-dll:err [_usb_reap_async] timeout error
In order to fix this I had to go into C:\Python27\Lib\site-packages\usb\legacy.py and on line 150 change:
 def bulkRead(self, endpoint, size, timeout = 100):
to:
 def bulkRead(self, endpoint, size, timeout = 1000):

Increasing the timeout could also probably be done from the nxt-python side. I would reccommend that change as this was a problem on 2 different computers I tried (64-bit win-7 and 64-bit win-8).

Hope this helps somebody,

- Alex
Reply all
Reply to author
Forward
0 new messages