Skip to content

Attempt to circumvent "OSError: image file is truncated" issue. #184

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

Merged
merged 1 commit into from
Mar 1, 2018

Conversation

webtweakers
Copy link

@webtweakers webtweakers commented Feb 28, 2018

as detailed here: python-pillow/Pillow#1510

When running the management command 'rendervariations' on a set of about 100.000 images, I bumped into the error message: image file is truncated (6 bytes not processed), which came form PIL that bumped into a faulty image (See PIL/ImageFile.py, line 232). The complete rendering stopped.

The exception isn't caught anywhere. I think ideally one wants a setting to control what to do on such a failure: skip, continue, halt...

For now I followed the suggestion as outlined in referenced Pillow issue, which solved the problem for me. See the changes in stdimage/models.py.

Btw: I tried following the contribution guide, but when i do a dcc django-stdimage, I get this error message:

dcc.DjangoCCError: The package "django-stdimage" does not support Django-CC.

So I offer this PR as a suggestion to fix the issue, but I suppose there are better ways.

@codecov
Copy link

codecov bot commented Feb 28, 2018

Codecov Report

Merging #184 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #184      +/-   ##
==========================================
+ Coverage   96.41%   96.42%   +0.01%     
==========================================
  Files           5        5              
  Lines         251      252       +1     
==========================================
+ Hits          242      243       +1     
  Misses          9        9
Impacted Files Coverage Δ
stdimage/models.py 95.12% <100%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a72208...ec62456. Read the comment docs.

Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @webtweakers thanks for the great contribution. Looks all good to me. Could you do me a favor and drop all none related changes (author, changelog, .gitignore).
I am happy to clean those up in a separate commit including the contributing guide.
Best
-joe

@webtweakers
Copy link
Author

My bad. Extraneous files have been removed.

@codingjoe codingjoe merged commit 34bc1e0 into codingjoe:master Mar 1, 2018
@codingjoe
Copy link
Owner

Released in 3.0.1
Thx @webtweakers !

@webtweakers
Copy link
Author

Great! Thanks for the quick work.

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