Unhelpful error if libwebp is not installed. #2309

Open
khazhyk opened this Issue Dec 25, 2016 · 2 comments

Projects

None yet

2 participants

@khazhyk
khazhyk commented Dec 25, 2016

What did you do?

Tried to open a webp file.

What did you expect to happen?

The webp file opened, or PIL would notify me that it was compiled without webp support.

What actually happened?

Got generic 'OSError: cannot identify image file'

What versions of Pillow and Python are you using?

Python 3.5, Pillow 3.4.2

Judging by #1930 a more specific error doesn't seem unreasonable, and could speed up troubleshooting for others in the future.

@aclark4life
Member

@khazhyk Can you send a pull request with the changes you want? Also what platform did you install on? I know that if you compile Pillow you'll see webp missing… but maybe you installed a pre-built wheel.

@khazhyk
khazhyk commented Dec 26, 2016

I had installed (not from wheel) a while ago and just so happened to recently to start using webp.

From what I understand by the code, a plugin will fail to import (and register) if the native extension isn't compiled (and logs to debug), which means by the time we reach open() we can't distinguish between something that matches no plugins and something that would match a plugin if it's native portion had been compiled. It seems like that could be changed to allow for that, although I don't fully understand PIL's design or rationale for what implications that would have.

@aclark4life aclark4life added the Bug label Jan 8, 2017
@aclark4life aclark4life added this to the Future milestone Jan 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment