Skip to content

--add-data not work for a folder #8282

Answered by rokm
BOXERRMD asked this question in Help
Discussion options

You must be logged in to vote

with open('Images/save.json', 'r') as file assumes that this Images directory is in your current working directory, which is not the case with onefile builds (nor with onedir ones anymore, for that matter). Anchor the path to __file__, as explained in the docs: https://pyinstaller.org/en/stable/runtime-information.html#using-file


--add-data "./Images/*;Images"

As a side note, avoid using glob, as it will result in unexpected behavior if Images contains sub-directories (i.e., their content will end up directly in Images instead of the corresponding sub-directories).

--add-data "./Images;Images" should suffice.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@BOXERRMD
Comment options

Answer selected by BOXERRMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants