IOError: encoder jpeg not available
Posted 1 month, 1 week ago
Recently, I ran into this bug on my new Macbook Pro
- Traceback (most recent call last):
- File "userprofile/tests.py", line 410, in test_profile_image_change
- image1 = self.generate_image()
- File "userprofile/tests.py", line 238, in generate_image
- Image.new('RGB', (800, 600)).save(tmp, 'JPEG')
- File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1439, in save
- save_handler(self, fp, filename)
- File "/Library/Python/2.7/site-packages/PIL/JpegImagePlugin.py", line 471, in _save
- ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
- File "/Library/Python/2.7/site-packages/PIL/ImageFile.py", line 495, in _save
- e = Image._getencoder(im.mode, e, a, im.encoderconfig)
- File "/Library/Python/2.7/site-packages/PIL/Image.py", line 401, in _getencoder
- raise IOError("encoder %s not available" % encoder_name)
- IOError: encoder jpeg not available
The fix for this was simple as provided by Quan, one of the devs I work with on a project. The reason is JPEG support is not available in PIL 1.1.7. To fix this:
- sudo pip uninstall PIL
- sudo brew install jpeg
- sudo pip install PIL
Category: Python
Leave a Comment



