Skip to content

Conversation

@dendenxu
Copy link

This commit fixes the issue where an unfinished multi-part file could not be loaded properly in the python warpper for OpenEXR. This happens when headers for the multi-part file are written to disk but the actual pixels never finish being written.

The current fix skips the corrupted or empty parts with no pixel data while retaining the ability for loading the correct ones.

An example test image with 500 headers but only 10 parts with valid pixel data:
(uploaded as zip since GitHub doesn't support the EXR extension)
000000.zip

Python code for testing:

import OpenEXR
f = OpenEXR.File('000000.exr') # without the fix, would throw an exception here
print(len(f.parts)) # should be 10

In one line:

python -c "import OpenEXR; print(len(OpenEXR.File('000000.exr').parts))"

This commit fixes the issue where an unfinished multi-part file could
not be loaded properly in the python warpper for OpenEXR. This happens
when headers for the multi-part file are written to disk but the actual
pixels never finish being written.

The current fix skips the corrupted or empty parts with no pixel data
while retaining the ability for loading the correct ones.

Signed-off-by: dendenxu <zhenx@zju.edu.cn>
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 14, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: dendenxu / name: Zhen Xu (0c036ad)

@dendenxu dendenxu changed the title Fix unfinished multi-part file loading in the py Fix unfinished multi-part file loading in the python wrapper Oct 14, 2025
@cary-ilm
Copy link
Member

Same as #2149, this looks good, but there should be a test in the test suite to illustrate and validate the behavior. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants