Skip to content

Commit 0da019f

Browse files
committed
print error when library could not be imported
1 parent d336187 commit 0da019f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pylabrobot/io/usb.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
import usb.util
1717

1818
USE_USB = True
19-
except ImportError:
19+
except ImportError as e:
2020
USE_USB = False
21+
_USB_IMPORT_ERROR = e
2122

2223

2324
if TYPE_CHECKING:
@@ -304,7 +305,8 @@ async def setup(self):
304305

305306
if not USE_USB:
306307
raise RuntimeError(
307-
"USB is not enabled. Please install pyusb and libusb. "
308+
f"USB dependencies could not be imported due to the following error: {_USB_IMPORT_ERROR}. "
309+
"Please install pyusb and libusb. "
308310
"https://docs.pylabrobot.org/installation.html"
309311
)
310312

0 commit comments

Comments
 (0)