Skip to content

Possible pyfive bug/edge case #158

@mo-gill

Description

@mo-gill

This issue is to cross reference this one from cmip7repack NCAS-CMS/cmip7_repack#21

I have been using check_cmip7_packing successfully for many files and it has been working great. However, on one particular file it fails with a CAN'T PARSE exit code of 5.

I have checked this file via a few different methods and it appears to be normal, and have successfully run the check on other similar files that have worked fine.

After having a dig the problem appears to occur in pyfive. Possibly some sort of edge case?

>>> import pyfive
>>> f = pyfive.File("filename")
>>> f.consolidated_metadata
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<redacted>/lib/python3.10/site-packages/pyfive/high_level.py", line 272, in consolidated_metadata
    if isinstance(f[ds], Dataset):
  File "<redacted>/lib/python3.10/site-packages/pyfive/high_level.py", line 64, in __getitem__
    return self.__getitem_lazy_control(y, noindex=False)
  File "<redacted>/lib/python3.10/site-packages/pyfive/high_level.py", line 129, in __getitem_lazy_control
    return Dataset(obj_name, DatasetID(dataobjs, noindex=noindex), self)
  File "<redacted>/lib/python3.10/site-packages/pyfive/h5d.py", line 96, in __init__
    self._meta = DatasetMeta(dataobject)
  File "<redacted>/lib/python3.10/site-packages/pyfive/h5d.py", line 699, in __init__
    self.attributes = dataobject.get_attributes()
  File "<redacted>/lib/python3.10/site-packages/pyfive/dataobjects.py", line 155, in get_attributes
    more_attrs = self._get_attributes_from_attr_info(attrs, attr_info)
  File "<redacted>/lib/python3.10/site-packages/pyfive/dataobjects.py", line 181, in _get_attributes_from_attr_info
    name, value = self._parse_attribute_msg(data,0)
  File "<redacted>/lib/python3.10/site-packages/pyfive/dataobjects.py", line 197, in _parse_attribute_msg
    version = struct.unpack_from('<B', buffer, offset)[0]
struct.error: unpack_from requires a buffer of at least 1 bytes for unpacking 1 bytes at offset 0 (actual buffer size is 0)

We have hosted the file on JASMIN, if you would be able to investigate this it would be much appreciated:
~cdds/tmp/pyfive_error/

Thankyou!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions