Closed christianferber closed 5 months ago
I'm not a user of pyinstaller and can not really assist with this issue. If there is something that can be done in the scope of this library, however, I will gladly accept pull-requests.
@christianferber can you share with us the pyinstaller spec or a repository where we can try building it?
Hi Remy,
thanks for your help!
Find attached a very simple py file with schwifty code.
You can compile it on Windows + pyinstaller with the command:
pyinstaller schwifty-test.py --name schwifty-test --onefile –console
After executing the resulting .exe file in the CMD window you should see the error below.
Regards,
Christian
Traceback (most recent call last):
File "C:\Users\christi\Documents\python\schwifti-test\schwifty-test.py", line 1, in
from schwifty import IBAN
File "
File "
File "
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "schwifty__init__.py", line 6, in
File "
File "
File "
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "schwifty\bban.py", line 9, in
File "
File "
File "
File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
File "schwifty\bic.py", line 465, in
File "schwifty\registry.py", line 85, in build_index
File "schwifty\registry.py", line 63, in get
ValueError: Failed to load registry bank
[23764] Failed to execute script 'schwifty-test' due to unhandled exception!
Von: Rémy HUBSCHER @. Gesendet: Sonntag, 7. April 2024 09:52 An: mdomke/schwifty @.> Cc: christianferber @.>; Mention @.> Betreff: Re: [mdomke/schwifty] When trying to compile code with pyinstaller a frozen importlib error is raised (Issue #187)
@christianferber https://github.com/christianferber can you share with us the pyinstaller spec or a repository where we can try building it?
— Reply to this email directly, view it on GitHub https://github.com/mdomke/schwifty/issues/187#issuecomment-2041355779 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BHQFPSCQAA22FJ5EF3BN3FLY4D3KDAVCNFSM6AAAAABFR3ZUFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGM2TKNZXHE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BHQFPSCQFRGTR55IGL7SLUTY4D3KDA5CNFSM6AAAAABFR3ZUFCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTZVSPAG.gif Message ID: @. @.> >
There is no attachment to the issue, I believe you sent it via e-mail.
I unfortunately don't have a Windows machine at hand to run the command. However make sure that all the files regarding the registry are visible from py-installer, especially the JSON files of the registry that might have been ignored by the default configuration.
schwifty-test.zip Here's the attachment. Sorry, yes, it was sent by e-mail.
I believe you need to add the JSON files as resources see: https://stackoverflow.com/a/47028343
Thanks for the hint! I was able to get it working. There was the add-data as well as --copy-metadata parameter required as per below. pyinstaller schwifty-test.py --name schwifty-test --onefile --console --add-data=C:\Users\christi\AppData\Local\Programs\Python\Python312\Lib\site-packages\schwifty:. --copy-metadata schwifty
Thanks @Natim for the investigation. @christianferber we can close the issue, right?
Closing the ticket as the issue is resolved.
The issue is described here and I haven't found a valid solution so far: https://github.com/pyinstaller/pyinstaller/issues/5390
Can anybody provide some help?