'Subfolders flattened in PyInstaller add-data

I'm attempting to include a directory in my PyInstaller Python application using --add-data="path/to/s1/*"

This particular sub folder is structured like:

|...
|----/s1
|----|----/database
|----|----|----add.py
|----|----|----remove.py
|----|----/plot
|----|----|----bar_chart.py
|----|----|----pie_chart.py
|...

However, when doing this my subfolder structure is lost! database and plot are no longer subfolders of s1. The structure is flattened to root and all folders are stored together.

Is there any way to maintain my original sub folder structure without having to reorganize my entire Python project?



Solution 1:[1]

Turns out I was actually able to achieve my desired output by just copying the original file structure from my src/ folder into my dist/ directory after building.

Could be a flawed solution, but I haven't discovered any issues with it so far...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cramos24