Skip to content

Commit

Permalink
Merge pull request #62 from chi-lambda/safe-import-on-non-pi-systems
Browse files Browse the repository at this point in the history
Made imports of GPIO fail less disruptively on non-Pi systems.
  • Loading branch information
joukos committed Aug 7, 2020
2 parents 349edc2 + cd173a0 commit 5ffe395
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/driver_it8951.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import RPi.GPIO as GPIO
except ImportError:
pass
except RuntimeError as e:
print(str(e))

class IT8951(DisplayDriver):
"""A generic driver for displays that use a IT8951 controller board.
Expand Down
2 changes: 2 additions & 0 deletions drivers/drivers_4in2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import RPi.GPIO as GPIO
except ImportError:
pass
except RuntimeError as e:
print(str(e))

# The driver works as follows:
#
Expand Down
2 changes: 2 additions & 0 deletions drivers/drivers_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import RPi.GPIO as GPIO
except ImportError:
pass
except RuntimeError as e:
print(str(e))


class DisplayDriver(ABC):
Expand Down

0 comments on commit 5ffe395

Please sign in to comment.