I have been reading the documentation of the pyinstaller for hours. I cannot understand how to use the option --resource RESOURCE
It says
-r RES
Im not sure if you still need help, but this should help future people who come here from google. Use the spec file that is made when you first run pyinstaller on a py script. From there you can add json and other data files like below
# -*- mode: python -*-
block_cipher = None
added_files = [
( 'configREs.json', '.'), # Loads the '' file from
# your root folder and outputs it with
# the same name on the same place.
]
a = Analysis(['gui.pyw'],
pathex=['D:\\OneDrive\\Programming\\Python Projects\\Python'],
binaries=[],
datas=added_files,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='name here',
debug=False,
strip=False,
upx=True,
console=False, icon='iconname.ico', version='version.rc' )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='gui')
I converted the python application to exe with pyinstaller using below cmmand
pyinstaller --onefile main.py
and then I copied the json file to the dist folder created by pyinstaller and it worked. hope this helps you to resolve this issue.
Note : I havent included any resource command with pyinstaller