Home » Odeon Blogs » Nai Chng »

IOError: encoder jpeg not available

IOError: encoder jpeg not available

Recently, I ran into this bug on my new Macbook Pro


  1. Traceback (most recent call last):
  2. File "userprofile/tests.py", line 410, in test_profile_image_change
  3. image1 = self.generate_image()
  4. File "userprofile/tests.py", line 238, in generate_image
  5. Image.new('RGB', (800, 600)).save(tmp, 'JPEG')
  6. File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1439, in save
  7. save_handler(self, fp, filename)
  8. File "/Library/Python/2.7/site-packages/PIL/JpegImagePlugin.py", line 471, in _save
  9. ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
  10. File "/Library/Python/2.7/site-packages/PIL/ImageFile.py", line 495, in _save
  11. e = Image._getencoder(im.mode, e, a, im.encoderconfig)
  12. File "/Library/Python/2.7/site-packages/PIL/Image.py", line 401, in _getencoder
  13. raise IOError("encoder %s not available" % encoder_name)
  14. 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:
  1. sudo pip uninstall PIL
  2. sudo brew install jpeg
  3. sudo pip install PIL
The should resolve the error.


Category: Python


Tagged as: django python



Leave a Comment :

(required)


(required)




(required)








Page generated in: 0.14s