-
Hello, pyinstaller rpc.py --noconsole --onefile -i circle-3041437_19201.ico --add-data "./Images/*;Images" --add-data "rpc.kv;." it doesn't work and returns an error when the main file tries to open a file located, as I've written in the code, at "Image/FILE". Could someone please help me find a solution? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As a side note, avoid using glob, as it will result in unexpected behavior if
|
Beta Was this translation helpful? Give feedback.
with open('Images/save.json', 'r') as file
assumes that thisImages
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-fileAs 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 inImages
instead of the corresponding sub-directories).--add-data "./Images;Images"
should suffice.