From ef1949e0371003f4d496bd44dccf007774b40fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 22 May 2021 10:53:28 +0200 Subject: [PATCH] Lazy-load "qmk console" dependencies This keeps the rest of the cli usable even when `hidapi` and `pyusb` are not installed. --- lib/python/qmk/cli/console.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/python/qmk/cli/console.py b/lib/python/qmk/cli/console.py index 45ff0c8bee11..c65f1cfc9a9d 100644 --- a/lib/python/qmk/cli/console.py +++ b/lib/python/qmk/cli/console.py @@ -6,9 +6,6 @@ from threading import Thread from time import sleep, strftime -import hid -import usb.core - from milc import cli LOG_COLOR = { @@ -262,6 +259,12 @@ def list_devices(device_finder): def console(cli): """Acquire debugging information from usb hid devices """ + + global hid + global usb + import hid + import usb.core + vid = None pid = None index = 1