You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by goldelay January 30, 2024
Ciao Fabio, per poter accedere alle informazioni data/municipalities.json etc... su una build eseguibile effettuata con pyinstaller ho dovuto modificare il codice di data.py applicando questa fix:
from __future__ importannotationsfromdatetimeimportdatetimefromtypingimportAnyimportfsutilimportsys, osdefget_temp_dir():
ifgetattr(sys, 'frozen', False):
# Se l'applicazione è un eseguibile standalonereturnos.path.dirname(sys.executable)
else:
# Se l'applicazione è eseguita come script Pythonreturnos.path.dirname(os.path.abspath(__file__))
defget_data(filename: str) ->Any:
returnfsutil.read_file_json(fsutil.join_path(get_temp_dir(), f"data/{filename}"))
#return fsutil.read_file_json(fsutil.join_path(__file__, f"data/{filename}"))
la function get_temp_dir() serve ovviamente a dirottare le chiamate per caricare i file dalla cartella del componente di python alla root dell'esegiubile nel momento in cui è un eseguibile.
In questo modo copiando la cartella .\data*.json contenuta dentro al tuo componente dentro la root dell'applicazione EXE permette di funzionare riuscendo così ad elaborare i dati per generare e verificare il codice fiscale al di fuori quindi del contesto python/componente.
Spero di esser stato d'aiuto
Saluti
Umberto Neri
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
Discussed in #151
Originally posted by goldelay January 30, 2024
Ciao Fabio, per poter accedere alle informazioni data/municipalities.json etc... su una build eseguibile effettuata con pyinstaller ho dovuto modificare il codice di data.py applicando questa fix:
la function get_temp_dir() serve ovviamente a dirottare le chiamate per caricare i file dalla cartella del componente di python alla root dell'esegiubile nel momento in cui è un eseguibile.
In questo modo copiando la cartella .\data*.json contenuta dentro al tuo componente dentro la root dell'applicazione EXE permette di funzionare riuscendo così ad elaborare i dati per generare e verificare il codice fiscale al di fuori quindi del contesto python/componente.
Spero di esser stato d'aiuto
Saluti
Umberto Neri
Upvote & Fund
The text was updated successfully, but these errors were encountered: