Skip to content

Commit 5ffe395

Browse files
authored
Merge pull request #62 from chi-lambda/safe-import-on-non-pi-systems
Made imports of GPIO fail less disruptively on non-Pi systems.
2 parents 349edc2 + cd173a0 commit 5ffe395

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

drivers/driver_it8951.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import RPi.GPIO as GPIO
99
except ImportError:
1010
pass
11+
except RuntimeError as e:
12+
print(str(e))
1113

1214
class IT8951(DisplayDriver):
1315
"""A generic driver for displays that use a IT8951 controller board.

drivers/drivers_4in2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import RPi.GPIO as GPIO
2424
except ImportError:
2525
pass
26+
except RuntimeError as e:
27+
print(str(e))
2628

2729
# The driver works as follows:
2830
#

drivers/drivers_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import RPi.GPIO as GPIO
2727
except ImportError:
2828
pass
29+
except RuntimeError as e:
30+
print(str(e))
2931

3032

3133
class DisplayDriver(ABC):

0 commit comments

Comments
 (0)