OK - i tried this out @bwoodsend

Created the hook-pycountry.py file you described it.

And then i tried it to compile the exe-file with: pyinstaller --onefile 
--additional-hooks-dir=. temp5.py

The creation of the temp5.exe file was sucessful - but when i try to start 
the exe-file i get this error message:
Traceback (most recent call last):
  File "temp5.py", line 3, in <module>
  File "pycountry\db.py", line 40, in load_if_needed
  File "pycountry\db.py", line 69, in _load
FileNotFoundError: [Errno 2] No such file or directory: 
'C:\\Users\\Polzi\\AppData\\Local\\Temp\\_MEI114722\\pycountry\\databases\\iso3166-1.json'
[42284] Failed to execute script temp5

Have i misunderstood something?
Thanks for your patience...

bwoodsend schrieb am Freitag, 2. Oktober 2020 um 09:49:21 UTC+2:

> If you want to recycle fixes for a specific library then you can create a 
> hook <https://pyinstaller.readthedocs.io/en/stable/hooks.html> for it 
> which you can copy between projects. In this case it would be a file called 
> hook-pycountry.py containing:
>
>  from PyInstaller.utils.hooks import copy_metadata  
>  datas = copy_metadata("pycountry")
>
> Put it in the same folder as your main code and add 
> --additional-hooks-dir=. to your build command. (Note you must always use 
> --clean when you add/change a hook.) With this you can go back to using 
> PyInstaller 
> my_code.py and ignore the spec file. If you prefer the spec then add '.' 
> to the hookspath=[].
>
> Once your happy with it you may send the hook to the hooks repo 
> <http://github.com/pyinstaller/pyinstaller-hooks-contrib/> and it’ll be 
> included in the next release. Then all you’d have to do upgrade to the 
> latest release:
>
> pip install -U pyinstaller-hooks-contrib
>
> And you can forget about all of this…
>

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/4b4fa53c-2db5-4027-a59e-342f5e1dd9ddn%40googlegroups.com.

Reply via email to