Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Python error reporting for ImageOutput and IB.set_pixels #2127

Merged
merged 1 commit into from
Jan 9, 2019

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Jan 2, 2019

The underlying decoding of pixel value arrays -- used by some of the
ImageOutput methods and ImageBuf.set_pixels -- threw exceptions when
the pixel array didn't conform to expectations. This led to very
confusing behavior, and crashes if the python program didn't carefully
catch them. Instead of throwing exceptions, bubble up an error message
for the usual OIIO error reporting, so wrongly-shaped pixel data arrays
are treated similarly to other kinds of error.

Also, detect with a better error message cases where user tries to write
scanlines to a tiled file or vice versa -- it was handled well in C++,
but the Python would start by parsing the pixel array, then have a
confusing error that it was the wrong shape, instead of the more clear
error message about using tiles instead of scanlines.

The underlying decoding of pixel value arrays -- used by some of the
ImageOutput methods and ImageBuf.set_pixels -- threw exceptions when
the pixel array didn't conform to expectations. This led to very
confusing behavior, and crashes if the python program didn't carefully
catch them. Instead of throwing exceptions, bubble up an error message
for the usual OIIO error reporting, so wrongly-shaped pixel data arrays
are treated similarly to other kinds of error.

Also, detect with a better error message cases where user tries to write
scanlines to a tiled file or vice versa -- it was handled well in C++,
but the Python would start by parsing the pixel array, then have a
confusing error that it was the wrong shape, instead of the more clear
error message about using tiles instead of scanlines.
@lgritz lgritz merged commit 304a03c into AcademySoftwareFoundation:master Jan 9, 2019
@lgritz lgritz deleted the lg-pyerror branch January 11, 2019 16:51
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Jan 11, 2019
…demySoftwareFoundation#2127)

The underlying decoding of pixel value arrays -- used by some of the
ImageOutput methods and ImageBuf.set_pixels -- threw exceptions when
the pixel array didn't conform to expectations. This led to very
confusing behavior, and crashes if the python program didn't carefully
catch them. Instead of throwing exceptions, bubble up an error message
for the usual OIIO error reporting, so wrongly-shaped pixel data arrays
are treated similarly to other kinds of error.

Also, detect with a better error message cases where user tries to write
scanlines to a tiled file or vice versa -- it was handled well in C++,
but the Python would start by parsing the pixel array, then have a
confusing error that it was the wrong shape, instead of the more clear
error message about using tiles instead of scanlines.
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.

1 participant