@ogra
inside the directory, Iβm doing the following steps:
$ snapcraft --debug
$ sudo snap install olibox-core_0.1dev_amd64.snap --devmode --dangerous
run the app with following command:
$ olibox-core
after this command, error appears.
@ogra
inside the directory, Iβm doing the following steps:
$ snapcraft --debug
$ sudo snap install olibox-core_0.1dev_amd64.snap --devmode --dangerous
run the app with following command:
$ olibox-core
after this command, error appears.
make sure to run snapcraft clean
if you made changes and trigger a new build, so the multipass vm gets wiped β¦
I do that every time before starting a new build but no luck!
hmm, the source:
tree from your snapcraft.yaml seems to not exist on github β¦
oh, in fact, you seem to have two source:
entries in the snapcraft.yaml β¦ make sure to comment the one pointing to the non-existing github tree !
(i wonder why the snapcraft yaml parser does not refuse to build with this β¦ it should surely catch such duplcated lines)
still getting the same error.
looking again, you also have two base:
entries, drop the one pointing to βcoreβ you can really only have one (and i guess snspcraft just picked the second one and defaulted to core instead of core18)
Iβm stupid.
I created a new repo (https://github.com/m-yahya/snap-tutorial.git) and dropping the extra core
seems working.
So, at this moment I can read the config file.
Iβll open another topic to describe what I wanted to achieve at the end.
Thank you all for your precious time and help, very much appreciated.
can you please say a few words about file path, how they are determine?
do I need to specify file path relative to modules or file path should be relative to home directory?
for example with the following app structure:
.
βββ config.toml
βββ environmentals
βββ LICENSE
βββ olibox_core
β βββ olibox_core
β βββ __init__.py
β βββ olibox_core.py
β βββ olibox_pkg
β βββ config.py
β βββ environments.py
β βββ __init__.py
β βββ user.py
βββ olibox-core_0.1dev_amd64.snap
βββ README.md
βββ requirements.txt
βββ setup.py
βββ snap
β βββ snapcraft.yaml
βββ tests
βββ helpers_tests.py
βββ oliboxcore_tests.py
if I want to access config.toml
file inside environments.py
then should I use '../../config.tml'
or just config.toml
?
thanks
if config.toml is copied into the root of your snap (either look inside the snap by unsquashing it, or use the snapcraft --debug feature to inspect the prime/ dir inside the builds (which is identical to the structure inside the snap) β¦ youβd access it by using something like os.environ['SNAP']
to read the toplevel path of the snap from the environment.
but assuming your config file should actually be configurable ($SNAP is the readonly bit of your snap) you probably want to use a configure or install hook to copy it to $SNAP_DATA (which corresponds to /var/snap/<snapname>/current/
(needs root, due to being in /var)) or SNAP_USER_DATA (i.e.: ~/snap/<snapname>/current/
)
and make the app read it from there β¦
Itβs really helpful, thanks
Iβll open a new topic and tag you there.