Skip to content

Commit f4ee725

Browse files
authored
Merge pull request #42 from dhalbert/frozen-order
adjust frozen path order only if necessary
2 parents 36ec7b3 + 55e9aba commit f4ee725

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

adafruit_circuitplayground/express.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@
3838
import sys
3939
import time
4040
# pylint: disable=wrong-import-position
41-
sys.path.insert(0, ".frozen") # prefer frozen modules over local
41+
try:
42+
lib_index = sys.path.index("/lib") # pylint: disable=invalid-name
43+
if lib_index < sys.path.index(".frozen"):
44+
# Prefer frozen modules over those in /lib.
45+
sys.path.insert(lib_index, ".frozen")
46+
except ValueError:
47+
# Don't change sys.path if it doesn't contain "lib" or ".frozen".
48+
pass
4249

4350
import adafruit_lis3dh
4451
import adafruit_thermistor

0 commit comments

Comments
 (0)