Modify ↓
Ticket #144 (closed enhancement: fixed)
pytz timezone object creation fails with pyinstaller
| Reported by: | seahawk1986@… | Owned by: | matysek |
|---|---|---|---|
| Priority: | normal | Milestone: | PyInstaller 2.1 |
| Component: | Hooks | Version: | 2.0 |
| Severity: | normal | Keywords: | Import-Hook |
| Cc: |
Description
Hello, I have problems packing the following code in to one *.exe file: test.py
...
import pytz
mytz = pytz.timezone('Europe/Berlin')
...
Package ist created using
C:\Python25\pyinstaller-1.3\makespec.py -F --icon=icon.ico test.py
C:\Python25\pyinstaller-1.3\Build.py test.spec
pytz is Version 2009u
Warntest.txt shows:
W: delayed __import__ hack detected at line 0 - pytz (C:\Users\myuser\Documents\Test\pytz\__init__.pyc)
Traceback when program test.exe is run:
Traceback (most recent call last): File "<string>", line 32, in <module> File "C:\Users\myuser\Documents\Test\buildtest\out1.pyz/pytz", line 157, in timezone pytz.UnknownTimeZoneError: 'Europe/Berlin'
Any idea how to prevent this error?
Attachments
Change History
comment:1 Changed 22 months ago by htgoebel
- Keywords Import-Hook added; pytz timezone removed
- Type changed from defect to enhancement
- Severity changed from major to normal
comment:2 Changed 15 months ago by htgoebel
- Owner changed from giovannibajo to htgoebel
- Status changed from new to assigned
- Component changed from PyInstaller to Hooks
Note: See
TracTickets for help on using
tickets.

This is simply, because pytz needs to have the zoneinfo files bundled.
Thee options: 1) adapt the .spec to include the zonefiles a data files 2) Either use a egg (which should be included as a whole) 3) implement an import hook.