First of all I created binaries of python scripts using the following commands in ubuntu:
cython3 --embed -o hello.c hello.py
gcc -Os -I /usr/include/python3.5m -o hello hello.c -lpython3.5m -lpthread -lm -lutil -ldl
But there are some issues which I need to discuss:
If I delete python scripts then binaries gives import error (which are importing from .py files).
And if I do not delete .py files then all the binaries working perfectly (which totally makes nonsense of the creation of binaries)
Now I know the issue is running files are binaries and the import some constants and functions in binaries are from .py scripts.
My project structure is below:
Main
Scripts1
Script1.py
Script2.py
Script3.py
& many other .py scripts
Scrip1.1
Script1_1.py
Script1_2.py
& many other .py scripts
Script2
Script1.py
Script2.py
& many other .py scripts
Is there any way to execute binaries which have all import constants/functions in it at the time of its creation?
And is there any way to generate binaries from .c code of .py using gcc which will be executable without have any .py scripts in it?
And also will there be no issue of importing from .py scripts?
Example:
from script1 import function1
from script1_2 import constants
Actually the issue is this import is from python script in binary file and i want this import in binary from another binary file. when i delete the .py scripts from the folder the error is "Import error: cannot import function1 from script1. There is no such a file script1.py"