Skip to content

Commit 058c945

Browse files
authored
Merge pull request #21 from zzsnzmn/check_circuitpython_version
Raise ImportError if using CircuitPython < 3.
2 parents 90e4ca9 + 39daae4 commit 058c945

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

adafruit_hid/consumer_control.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
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+
35+
# pylint: disable=wrong-import-position
3136
import time
3237
import usb_hid
3338

adafruit_hid/gamepad.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
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+
35+
# pylint: disable=wrong-import-position
3136
import struct
3237
import time
3338
import usb_hid

0 commit comments

Comments
 (0)