Skip to content

Commit 2a9a60b

Browse files
committed
Raise ImportError if using CircuitPython < 3.
1 parent 90e4ca9 commit 2a9a60b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

adafruit_hid/consumer_control.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
* Author(s): Dan Halbert
2929
"""
3030

31+
import sys
32+
if sys.implementation[1][0] < 3:
33+
raise ImportError('{0} is not supported in CircuitPython 2.x or lower'.format(__name__))
34+
3135
import time
3236
import usb_hid
3337

adafruit_hid/gamepad.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
* Author(s): Dan Halbert
2929
"""
3030

31+
import sys
32+
if sys.implementation[1][0] < 3:
33+
raise ImportError('{0} is not supported in CircuitPython 2.x or lower'.format(__name__))
34+
3135
import struct
3236
import time
3337
import usb_hid

0 commit comments

Comments
 (0)