Issue with running python script from a dotnet application

We have a dotnet application which calls a simple python hello word program inside it :

The snapcraft.yaml is as below

    name: processorsnap
    version: '0.1'
    summary: A simple example snap for dotnet in snaps
    description: A simple example snap for dotnet in snaps

    grade: devel 
    confinement: strict 

    base: core

        command: IoT_AnalyticsProcessor.Service
        daemon: simple
        - network-bind
        - network

        source: .
        plugin: dump
            - libasn1-8-heimdal
            - libcurl3
            - libgssapi3-heimdal
            - libhcrypto4-heimdal
            - libheimbase1-heimdal
            - libheimntlm0-heimdal
            - libhx509-5-heimdal
            - libkrb5-26-heimdal
            - libldap-2.4-2
            - liblttng-ust0
            - libroken18-heimdal
            - librtmp1
            - libsasl2-2
            - libunwind8
            - liburcu4
            - libwind0-heimdal
            - icu-devtools
            - wget
            - zlib1g
            - python

but when i snap it and run it i get the below error :

the actual output when i run normally without snapping is as below :

Am i missing something related to python here like plugin or stage or build packages ?

There’s two things that could be going-on:

  1. Your dotnet code might not be able to find
  2. Your is found but failing to execute.

For the first potential problem you need to find out where your app is looking for the and attempt to either put your there or amend the search to look in the location that the file actually exists.

For the second potential problem the likely reason is the #! line is pointing to the wrong python executable path, because the return code from the exec call is “file not found”.

Thanks for your response.

In our dotnet code we have specified the python runtime location (where the python executable file is found) /usr/bin/python and also the path of the python file

i tried to reproduce the error before snapping by giving a wrong path(for python runtime) and i see that this error occurs only if the path of the python runtime location is wrong :

so once i snap it if this error is occurring, what would be the reason ?.. the snap is not able to load the python executable from /usr/bin/python ??

Is python runtime automatically fetched by adding any libraries or build packages in snapcraft.yaml file ??

your dotnet app should invoke /usr/bin/env python instead … and your snap should contain the python executable (as well as all the python modules needs)