Read and write Bin files on snapcraft

Hi, I’m developing a program in python and I want to put on it in the snapcraft.
In my project I develop the .py file and the bin files all of then at the same folder.
My software read and write in this bin files.
After I create the setup.py, setup.cfg, README.md, Licence.txt and init.py.
After I upload this files on Github and create tha snapcraft.yaml
This files stay on: https://github.com/JunioDamasceno/gerenciadorcs

When released with sucessful (after several attempts)
I install the app in my pc, but when I try write in these files have an error and the app close, because the files is only read.

I noticed that the loose files like .bin, .png, .glade and .svg the snap created a folder for every type of files with the name of the files, and I changed the code so he could find the files. These folders and files stay in my pc on /snap/gerenciadorcs/current

I tried several ways for that the program could write the files. I think that a change in my snapcraft.yaml can solve this question.

My snapcraft.yaml:
snapcraft.yaml

You cannot write in the snap. it’s a read only file system:

Files you need to modify must be installed elsewhere:

  • $SNAP_COMMON
  • $SNAP_DATA
  • $SNAP_USER_DATA

See:


1 Like

Thank you Dimitri, your advices help me so much and I solved my problem.

I did a module in python for create the bin files and directories at $home of the user, and I changed the way of the files on main code.

The module check if the bin files exists, if not, it create then, if exist it not create.
In fact It create the files only in the first run the program.