-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
More informative error message for error reading InferenceData from NetCDF #1637
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1637 +/- ##
==========================================
- Coverage 90.91% 90.89% -0.03%
==========================================
Files 108 108
Lines 11671 11671
==========================================
- Hits 10611 10608 -3
- Misses 1060 1063 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only needs to be added to the changelog
else: | ||
groups[group] = data | ||
return InferenceData(**groups) | ||
except OSError as e: # pylint: disable=invalid-name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use e
(instead of err
or something a bit longer that pylint considers optimal) as variable to raise errors from other errors, it may be worth it to add it to .pylintrc
instead of having to disable the error every time
@OriolAbril @ColCarroll This is ready to go, if you are OK with it, please squash and merge. |
…etCDF (arviz-devs#1637) * More informative error message. * Blacken and pylint. * Update Changelog for PR 1637. Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
Description
Previously, when trying to read an
InferenceData
object usingfrom_netcdf
on a filesystem that did not support HDF5 file locking (full disclosure: I have no idea what HDF5 file locking is), one would get a crypticOSError: -101
which did not provide any assistance in fixing the problem.I tracked this down, and found a solution on StackOverflow. Because it's difficult to figure out (happens due to a dependency that is well down in the call tree), I tweaked
from_netcdf
to trap this error, and add an explanation.Checklist
Remarks
WRT the code style, running pylint locally I get it complaining that the use of
e
as a variable name is bad, but this is quite normal usage, stylistically, for variables that will be bound toException
's.