-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Support PyInstaller" broke Pyinstaller support #529
Comments
@wodo: Can you chime in on this? |
The start of our troubles was try to use babel and a lot of other packages (e.g. Sphinx) together in one pyinstaller generated exe. It seems the locale-data directory is searched from different packages at different places. One package call it |
These other packages (your packages?) tried to access Babel's locale-data directly? So if you update them to access I've submitted a PR that restores the old code. |
@yagebu Can you explain how PyInstaller does its thing? I can also find a commit from 2015 that removes a runtime hook that touched these paths (pyinstaller/pyinstaller@a7b29d8)... |
Yes pretty much. As far as I can tell
Maybe that hook was needed before PyInstaller set |
@akx: Do you have any more questions about this or is there anything else I can do to get the PR merged and this issue fixed? |
Hey @yagebu! Here's how I tested things out: te.pyimport babel
import babel.numbers # (see below!)
from babel.dates import format_datetime
import datetime
import argparse
ap = argparse.ArgumentParser()
ap.add_argument('locale')
args = ap.parse_args()
print(format_datetime(datetime.datetime.now(), locale=babel.Locale.parse(args.locale)))
With Babel 2.4
As an aside, there seems to be a minor bug in PyInstaller, making it require a dummy import of
|
Perfect @akx, thanks for the merge! |
currently getting
with pyinstaller 3.4 and python 3.6.4 on OSX I am importing tkcalendar, but not babel directly. |
@warrenstephens Can you open another issue with more information and repro steps, please? |
Hi there, I have the same problem...is there any solution??? |
PyInstaller has supported Babel for ages (it has had a hook for Babel since 2009). #505 actually broke PyInstaller support AFAICS (tested on Python 3.6 with PyInstaller dev version and Python 3.5 with the latest PyInstaller release). PyInstaller will automatically bundle the data files (
babel/locale-data
) using the hook and when the executable is run, these files are extracted to a temporary folder, say$TMP/_MEI123456/babel/locale-data
. However the new code will look for it in{sys._MEIPASS}/locale-data
, i.e.,$TMP/_MEI123456/locale-data
and fail.PyInstaller actually sets
__file__
for "frozen" modules to a path relative to the temp folder that the data files get extracted to (see pyinstaller/pyinstaller#1598 (comment)). So the old was already doing the right thing - if it didn't work in some setup, that was really a PyInstaller bug.The text was updated successfully, but these errors were encountered: