-
Notifications
You must be signed in to change notification settings - Fork 74
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
Raise exception instead of warning when cache isn't writable #150
Labels
enhancement
Idea or request for a new feature
Comments
leouieda
added
enhancement
Idea or request for a new feature
good first issue
Good for newcomers (doesn’t require deep knowledge of the project)
labels
Mar 12, 2020
6 tasks
leouieda
removed
the
good first issue
Good for newcomers (doesn’t require deep knowledge of the project)
label
May 9, 2020
Actually, this is probably not a good idea. Since the cache directory is created at import time, this would cause packages to crash immediately even if the user doesn't care about sample data (see scikit-image/scikit-image#4664). |
6 tasks
This was referenced May 11, 2020
leouieda
added a commit
that referenced
this issue
May 14, 2020
As seen in recent issues in scikit-image, creating the cache folder in `pooch.create` can cause problems since this function is called at import time by our users. This means that importing the package in parallel can cause race conditions and crashes. To prevent that from happening, delay the creation of the cache folder until `Pooch.fetch` or `retrieve` are called. Creating the folder name was factored out of `make_local_storage` into the new function `cache_location`. Both `fetch` and `retrieve` then use `make_local_storage` to create the folder while `create` only runs `cache_location`. Since we can't check if the cache is writable when calling `create`, then it makes more sense to raise an exception with the message about using the environment variable instead of a log message (as #150 wanted). Fixes #172
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the desired feature
As pointed out by @danshapero in #149, when the cache folder isn't writable we warn the user through an error message but don't re-raise the
PermissionError
that is generated. This might be OK for interactive environments like Jupyter but it would cause an error for a script and the actual warning would be lost in the traceback.A more sensible thing to do would be to add the message we create to the exception and re-raise it instead of logging.
The code for this is in
pooch/core.py
in themake_local_storage
function (after #149 is merged).The text was updated successfully, but these errors were encountered: