Skip to content

Behavior of readBytes for nonexistent paths (returning None) is unexpected. #12

@bdice

Description

@bdice

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. When readBytes is called on a nonexistent path, like traj.readBytes('potato'), it returns None. When getRecord is called on a nonexistent path, like traj.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 of getRecord in particular is non-obvious, and caused JSON decoding errors when trying to decipher an empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingminor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions