-
Notifications
You must be signed in to change notification settings - Fork 455
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
Replace __file__ with newer APIs #674
Comments
#533 is actually not to "blame" here – the package has been using I wouldn't mind a patch that has Babel attempt to use, say, |
Apologies for seeming to allocate blame. I was trying to say that #533 brought Babel to the point that tools which uses
That should be sufficient. I'll try it. |
I didn't mean it like that – let me explain:
#533 reverted some changes to that directory code that had been ultimately unnecessary; PyInstaller had had
Come to think of it, if |
#533 replaced custom data lookup with
__file__
, which works only if the resources are exported to a filesystem. See indygreg/PyOxidizer#69 for more info about why, but the tl;dr version is__file__
is an optional attribute and should not be relied upon. It also requires each zip/pack tool to fiddle with__file__
.Here is the current backtrace when
__file__
is not provided:There are stdlib APIs for this type of access, especially the now ancient
pkgutil.get_data
, and the newerimportlib.resources
and backportimportlib_resources
.Loading of resources from the runtime package should ideally be done using
importlib.resources
and its backport , howeverpkgutil
could be used to avoid the need for the backport. Usingpkgutil
doesn't work under PyOxidizer 0.4, however I expect that will be fixed soon.The text was updated successfully, but these errors were encountered: