-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Deprecate or remove use __file__ #196
Comments
Makes sense. I don't suppose it's as easy as this? Plus changing types from filename strings to read-in-file strings. -CACHE_FILE_DEFAULT = os.path.join(os.path.dirname(__file__), '.tld_set')
+CACHE_FILE_DEFAULT = pkgutil.get_data(__name__, '.tld_set') |
Is there a standard, usually writable location for this? Or a library to determine it? |
The xdg standard defines cache directories.
|
FYI, |
For reading
.tld_set
,__file__
should be replaced with pkgutil.get_data, which is used for.tld_set_snapshot
.The dataset file may have been placed into the package data via another means, and the attribute
__file__
may not be present at all, as it is an optional attribute of the Python module loading system. tldextract fails badly atm when it is missing. An example of when it is missing is PyOxidizer, and Nuitka also has similar problems.When it is missing, or when the package directory is not writable, the cache should be stored in a different location without a warning.
Currently I see the following for every invocation which imports tldextract, because it is installed as a system package used by system apps:
The text was updated successfully, but these errors were encountered: