Skip to content

Commit 412392c

Browse files
authored
Merge pull request #10 from dhalbert/frozen-order
adjust frozen path order only if necessary
2 parents e2590b9 + 47ce14f commit 412392c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

adafruit_crickit.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@
4949
from micropython import const
5050

5151
#pylint: disable=wrong-import-position
52-
sys.path.insert(0, ".frozen") # Prefer frozen modules over local.
52+
try:
53+
lib_index = sys.path.index("/lib") # pylint: disable=invalid-name
54+
if lib_index < sys.path.index(".frozen"):
55+
# Prefer frozen modules over those in /lib.
56+
sys.path.insert(lib_index, ".frozen")
57+
except ValueError:
58+
# Don't change sys.path if it doesn't contain "lib" or ".frozen".
59+
pass
5360

5461
from adafruit_seesaw.seesaw import Seesaw
5562
from adafruit_seesaw.pwmout import PWMOut

0 commit comments

Comments
 (0)