Open cercata opened 2 years ago
I haven't used pyinstaller
before, but it looks like you can use --add-data src;dest
to get it to bundle with -F
and find the scvars.json
in the right location relative to the bundle when referenced with the __file__
keyword. See https://pyinstaller.readthedocs.io/en/stable/runtime-information.html#:~:text=for%20these%20uses.-,Using%20__file__,relative%20to%20the%20bundle%20folder.
I'm already ussing --add-data with "." as dest, I don't know what's the path I should set for it to work whithout modifying scvars.py I'll try with "./simconnect" instead
I'll check also with the Spec file and "collect_data_files" as they advice ... I was just asking in case you had already used it ;)
ok, lmk how it goes. my reading of the doc is that you want --add-data=/path/to/simconnect/scvars.json;./simconnect
with the semicolon for windows but ymmv. packaging is always painful :)
If file is checked from inside a package or library (say my_library.data) then file will be [app root]/my_library/data.pyc and --add-data should mirror that:
PyInstaller --add-data=/path/to/my_library/file.dat:./my_library
Its working like a charm now, in file and in directory mode, whit this options:
--add-data "C:\Program Files\Python310\Lib\site-packages\simconnect\*.json;./simconnect" --add-binary "C:\Program Files\Python310\Lib\site-packages\simconnect\SimConnect.dll;./simconnect"
My guess is that for mainstream packages the people from pyinstaller already add those options automatically.
awesome! i'll add a note to the readme
Have you tryed packaging it with pyinstaller ?
I made it, and I get an error when it tries to load scvars.json. I solved it by removing the path in scvars.py, but it works only with "-D", not if I generate a single file with "-F"
Do you have a better a method ? I don't know why it doesn't work without modification, in theory when runing from pyinstaller "file" should be changed to the apropiate path ...