Problem with folder structure and imports for creating app with pyInstaller

Viewed 42

This is more like a architectural question, and i understand that this is possible the wrong place to ask. I have the following folder structure:

- BUILD
  - build
  - dist
  - project_1.spec
  - project_2.spec
- project_1
  - app.py
- project_2
  - app.py
- library_t
  - video.py
  - benchmark.py

This is just a small extract of my real structure. I want to pack my projects, which are mostly tkinter and kivy apps, into executables with pyInstaller. The spec files, dists and builds are all inside BUILD. However, i want to share a library across multiple projects and do not want to put them directly into the project folder. I managed to import the library in my projects like this:

import sys
sys.path.append("..")

from library_t.video import test_function

However, this does not include the import in my pyInstaller package. I could add the library_t folder with --add-data ../library_t;. but i want to be able to develop and test my app without changing the environment or imports. This is the command i use for creating the pyInstaller package from within the BUILD folder:

pyinstaller --noconfirm --icon=../project_1/icon.ico --name "Project 1" --add-data ../project_1/icon.ico;. ../project_1/app.py
0 Answers
Related