Skip to content

Fix unfinished multi-part file loading in the python wrapper#2148

Merged
cary-ilm merged 2 commits into
AcademySoftwareFoundation:mainfrom
dendenxu:bugfix/loading_unfinished_multipart_files
May 16, 2026
Merged

Fix unfinished multi-part file loading in the python wrapper#2148
cary-ilm merged 2 commits into
AcademySoftwareFoundation:mainfrom
dendenxu:bugfix/loading_unfinished_multipart_files

Conversation

@dendenxu

Copy link
Copy Markdown
Contributor

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

linux-foundation-easycla Bot commented Oct 14, 2025

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@cary-ilm cary-ilm merged commit 830bfb5 into AcademySoftwareFoundation:main May 16, 2026
2 of 3 checks passed
@cary-ilm

Copy link
Copy Markdown
Member

@dendenxu, I let this go stale waiting for a test to validate the behavior, but I'll merge it now as is and provide a test myself. Thanks for the contribution.

cary-ilm added a commit that referenced this pull request May 18, 2026
PR #2148 extends the python module to skip over parts with
invalid/unfinished pixel data, so it reads what it can. Reading
"header_only" reads all headers.

This adds a test to validate that behavior, using a test file with
corrupted chunk tables in two of the parts.

Made-with: Cursor

Signed-off-by: Cary Phillips <cary@ilm.com>
cary-ilm added a commit that referenced this pull request May 21, 2026
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>
Co-authored-by: Cary Phillips <cary@ilm.com>
cary-ilm added a commit that referenced this pull request May 21, 2026
PR #2148 extends the python module to skip over parts with
invalid/unfinished pixel data, so it reads what it can. Reading
"header_only" reads all headers.

This adds a test to validate that behavior, using a test file with
corrupted chunk tables in two of the parts.

Made-with: Cursor

Signed-off-by: Cary Phillips <cary@ilm.com>
palemieux pushed a commit to sandflow/openexr-ht that referenced this pull request Jun 10, 2026
…dation#2148)

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>
Co-authored-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
palemieux pushed a commit to sandflow/openexr-ht that referenced this pull request Jun 10, 2026
…mySoftwareFoundation#2421)

PR AcademySoftwareFoundation#2148 extends the python module to skip over parts with
invalid/unfinished pixel data, so it reads what it can. Reading
"header_only" reads all headers.

This adds a test to validate that behavior, using a test file with
corrupted chunk tables in two of the parts.

Made-with: Cursor

Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants