I have used hours … no days … to find out how to compile my Python program in to only one executable exe file (Windows, Python, coin-or MIP, PyInstaller).
The compiling it self worked, but the final exe file still require that the MIP files are available when executing the exe file. By other words: the MIP files were not included in the exe file.
File “C:\Users\jp\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py”, line 1170, in add_script
contents = importlib.util.decode_source(contents)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 770, in decode_source
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xf8 in position 292: invalid start byte
I solved the error by copying all files in to a subfolder to Python.
The compiling cmd command I use in this folder is “pyinstaller -D filename.py --additional-hooks-dir=./hooks/”
The compiling generates a “dist” folder with the exe file and beside that a folder called “_internal”. This “_internal” folder contain a lot of tiles from the MIP library.
If I execute the exe file from the folder generated, then it works.
If I move the exe file to an other folder, then it don’t work.
It seams like the exe file have to have access to the subfolder “_internal”. How do we solve this?
A few lines from the building process:
23956 WARNING: Hidden import “importlib_resources.trees” not found!
32861 INFO: Building EXE from EXE-00.toc completed successfully.
32876 INFO: checking COLLECT
32876 INFO: Building COLLECT because COLLECT-00.toc is non existent
32876 INFO: Building COLLECT COLLECT-00.toc
34215 INFO: Building COLLECT COLLECT-00.toc completed successfully.
There only one warning that I have listed. I don’t know what this waring means?