Hi, i’m trying to do a strict python snap that run on a Raspberry Pi 4 with Ubuntu Core 20.04 . I made my python snap in confinement devmode to test it, and it works. Now i want to convert it in a strict snap but when i run the snap i see the following error:
ls: cannot open directory '.': Permission denied
cp: cannot create regular file './Config_HRM_WB-RD_V3_4-64_AGC.json': Permission denied
The reference python code is the following (in the code i want to copy a json file from a folder in the current folder):
#!/usr/bin/env python3
import sys
import os
os.system('ls -l')
os.system('cp $SNAP/lib/python3.8/site-packages/iot-band/Config_HRM_WB-RD_V3_4-64_AGC.json .')
[...]
This is my snapcraft file (the daemon line is commented out because after solving this problem I want my snap to be a daemon):
name: iot-band
base: core20
version: '1.0'
summary: Iot band app
description: |
Iot band app
grade: devel
confinement: strict
apps:
iot-band:
environment:
PYTHONPATH: $SNAP/lib/python3.8/site-packages/iot-band
command: bin/iot_band.py
# daemon: simple
plugs:
- bluez
- network
- home
parts:
iot-band:
# See 'snapcraft plugins'
source: .
plugin: python
python-packages:
- .
bluez:
plugin: nil
stage-snaps: [bluez/edge]
pi-bluetooth:
plugin: nil
stage-snaps: [pi-bluetooth/edge]
stage:
- lib64/*
I think it is an interface problem but i don’t know how to fix it. How can i realize correctly the snap to resolve this problem?