Python3 application with external module

Thanks @zyga-snapd for your information.
Got your point i can’t dump any files at above specific location coz all these dir was created once the snap installed on the devices.

Adding one more query here -

Actually tried to create a python3 application snap which has some external module.
I am downloaded this module by writing it into a requirement.txt file which was further specifying in .yaml file.
Once the snap was created i didn’t found my .py file in the bin folder of prime.
Then i put this .py file manually at $SNAPCRAFT_INSTALL dir in the override-build.
Now, everything are ok but once i executed this file it doesn’t find the external module which were installed during the snapcraft build cycle.

Till now what i understand is that the .py file which i am copying manually is not placed at the virtual env created during build.

I suspect this is because the external module is a .so file and it needs to be dynamically loaded by python at runtime and it may need to be placed in a specific location.

Can you share some more details about it?

Thanku @zyga-snapd for being supportive and for your quick response.
Actually I over come this issue by adding a setup.py file at the same folder and i added my .py file in that setup.py file and i removed the override-build.
Now everything are working as expected.
May be you can please help me to understand from where this setup.py are called and at which stage of build cycle.

I don’t know that, that’s a snapcraft question and I’m much more experienced with snapd. Perhaps @sergiusens can explain that or refer to documentation.

Thanks @zyga-snapd !! Will wait for @sergiusens response and please let me know if you need more details. Appreciate your’s support :slight_smile:

Hello Team,

I am facing an issue when i changed my confinement from devmode to strict

i.e ping: icmp open socket: Permission denied

I have connected network and network-bind plugs with the sockets.
Can someone guide me which plugs i am missing ?

Let me brief you what my application are doing, it will check the internet connectivity on the device by pinging google.com and check the traceroute which will write the data into a file.

I think you need something more like network-control (https://snapcraft.io/docs/network-control-interface), there might be a less permissive interface, @jdstand might know more.

network-observe allows ping.

Thank u @jdstrand & @sergiusens for your info, Actually “network-control” was work for me, but the problem is one use to connect the plug with the slot manually as this snap is local. Does network-observe will get connect automatically? Or Is there any ways to connect these plug automatically?

Appreciate your help :slight_smile:

No

Yes, see Process for aliases, auto-connections and tracks