libusb error: LIBUSB_ERROR_NOT_FOUND | LabJack
 

libusb error: LIBUSB_ERROR_NOT_FOUND

4 posts / 0 new
Last post
SDJ
Stoffel's picture
libusb error: LIBUSB_ERROR_NOT_FOUND

Hi,

This week I received a LabJack U3-LV and I'm using it for reading analog signals using Python (3.8) and a MacBook Pro (13-inch, 2017, Four Thunderbolt 3 Ports, Catalina). I found that after plugging in the U3, I sometimes get the error: 
libusb error: LIBUSB_ERROR_NOT_FOUND

This is after running code:
import u3

d = u3.U3()

However, the error disappears after running the code above twice, without disconnecting the U3. Therefore, a simple workaround is following code:

import u3
import sys

try:
    d = u3.U3()
except:
    try:
        d = u3.U3()
    except:
        sys.exit()

Note: the U3 is detected by my computer if it generates the error mentioned above. I checked this with Terminal command:
ioreg -p IOUSB

Greetings
SDJ

LabJack Support
labjack support's picture
This is a known issue that

This is a known issue that first cropped up with macOS 10.15. It appears to be a macOS USB issue and Apple has been unresponsive to our support requests. We recommend retrying the the open call (like you are currently doing) as a workaround. Sorry for the inconvenience.

SDJ
Stoffel's picture
Thank you for the fast relpy

Thank you for the fast relpy and for providing great products! I'm very pleased to have found an interface that works on a Mac and on Linux.

SDJ
Stoffel's picture
Small update. To avoid a "too

Small update. To avoid a "too broad exception clause" warning when using PyCharm for the code above, try this:

import u3 import LabJackPython import sys def interface_check(): try: # First call d = u3.U3() except LabJackPython.NullHandleException: try: # Second call d = u3.U3() except LabJackPython.NullHandleException: # Closing the program sys.exit() def main(): interface_check() if __name__ == "__main__": main()