-
Notifications
You must be signed in to change notification settings - Fork 0
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
Behavior of readBytes for nonexistent paths (returning None) is unexpected. #12
Comments
(It is possible to work around this in |
Original comment by Matthew Spellings (Bitbucket: mspells, GitHub: klarh). The intent of
It's not really clear to me that raising a |
In my understanding, the current API cannot differentiate between a record that was written with an empty string and one that does not exist. Raising a In particular,
The second one is EAFP, and would be my preference (as it is "more Pythonic", but that may lose some meaning when discussing a Python library that is meant to be a C++ interface). |
Original comment by Matthew Spellings (Bitbucket: mspells, GitHub: klarh). FWIW, I always intended things like glotzformats to take the most recent version of whatever quantity with respect to the timestep it is given for things that aren't dumped on every frame (like Adding an |
Original report by me.
I am currently debugging a problem in glotzformats where the gtar file reader is misbehaving, when one frame has a
type_shapes.json
file but another frame does not.I've traced it back to a behavior in
libgetar
that I find unusual. WhenreadBytes
is called on a nonexistent path, liketraj.readBytes('potato')
, it returnsNone
. WhengetRecord
is called on a nonexistent path, liketraj.getRecord(gtar.Record('potato'))
, it returns an empty string.My expectation was that both of these would raise a
KeyError
. It's not clear what use case the current behavior is enabling / preserving. The behavior ofgetRecord
in particular is non-obvious, and caused JSON decoding errors when trying to decipher an empty string.The text was updated successfully, but these errors were encountered: