Skip to content

Avoid obscure crash when loading from empty file #101

@rhattersley

Description

@rhattersley

Iris load does not cope with empty files:

touch my_empty_file
python -c 'import iris; iris.load("my_empty_file")'

...
  File ".../iris/io/format_picker.py", line 238, in <lambda>
    MAGIC_NUMBER_32_BIT = FileElement('32-bit magic number', lambda filename, fh: struct.unpack('>L', fh.read(4))[0])
struct.error: unpack requires a string argument of length 4

Options: ignore; warn; or raise helpful error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions