I have bash script that execute python file and turn gpio pins on or off.
When running it on the device it works but as snap the python library (
RuntimeError: This module can only be run on a Raspberry Pi!.
Snapcraft file snapcraft.yaml:
grade: devel confinement: devmode parts: setup: plugin: python python-version: python2 python-packages: [RPi.GPIO] app-name : plugin: dump source: . stage-packages: - python3 apps: app-name: command: lightOn.sh $SNAP
Bash script lightOn.sh:
#!/bin/bash FILE1=$1 python $FILE1/myprogram.py
Python file myprogram.py:
#!/usr/bin/env python2 import RPi.GPIO as GPIO
The code have to run from bash script.
Is there a way to make the python library know that it running on Raspberry Pi from inside the snap?.
Or another way to access gpio pins from bash script inside snap.