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
from tzlocal import get_localzone
print(get_localzone())
python main.py runs OK
pyinstaller --onefile main.py
./main.exe runs KO with exception:
Traceback (most recent call last):
File "backports\zoneinfo\_common.py", line 15, in load_tzdata
File "importlib\resources.py", line 88, in open_binary
File "importlib\resources.py", line 47, in _get_package
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tzdata'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pytz_deprecation_shim\_impl.py", line 39, in timezone
File "pytz_deprecation_shim\_compat_py3.py", line 16, in get_timezone
File "backports\zoneinfo\_common.py", line 27, in load_tzdata
backports.zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Europe/Paris'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 2, in <module>
print(get_localzone())
File "tzlocal\win32.py", line 119, in get_localzone
File "pytz_deprecation_shim\_impl.py", line 41, in timezone
pytz_deprecation_shim._exceptions.UnknownTimeZoneError: 'Europe/Paris'
[26796] Failed to execute script 'main' due to unhandled exception!
pyinstaller --onefile main.py --collect-all tzlocal --collect-all tzdata
./main.exe runs OK
pyinstaller --onefile main.py --additional-hooks-dir hooks
./main.exe runs OK with hooks/ folder containing:
hook-pytz_deprecation_shim.py
# hidden reference to tzdata
from PyInstaller.utils.hooks import copy_metadata,collect_data_files
datas = []
datas += copy_metadata('tzdata')
datas += collect_data_files('tzdata', True)
The text was updated successfully, but these errors were encountered:
Which library is the hook for?
pytz_deprecation_shim used by tzlocal which is used by apscheduler
Have you gotten the library to work with pyinstaller?
Yes.
python 3.7.8 with tzlocal package installed (pip install tzlocal)
main.py:
python main.py runs OK
pyinstaller --onefile main.py
./main.exe runs KO with exception:
pyinstaller --onefile main.py --collect-all tzlocal --collect-all tzdata
./main.exe runs OK
pyinstaller --onefile main.py --additional-hooks-dir hooks
./main.exe runs OK with hooks/ folder containing:
hook-pytz_deprecation_shim.py
The text was updated successfully, but these errors were encountered: