Wednesday, December 23, 2015

Django :: IOError: encoder error -2 when writing image file


exceptions:IOError: encoder error -2 when writing image file

Traceback (most recent call last):
 File "/django_virtalenv//lib/python2.7/site-packages/newrelic-2.14.0.11/newrelic/hooks/framework_django.py", line 492, in wrapper return wrapped(*args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/contrib/admin/options.py", line 465, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view response = view_func(request, *args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/views/decorators/cache.py", line 52, in _wrapped_view_func response = view_func(request, *args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/contrib/admin/sites.py", line 198, in inner return view(request, *args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/utils/decorators.py", line 29, in _wrapper return bound_func(*args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view response = view_func(request, *args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/utils/decorators.py", line 25, in bound_func return func(self, *args2, **kwargs2)
 File "/django_virtalenv//lib/python2.7/site-packages/django/db/transaction.py", line 371, in inner return func(*args, **kwargs)
 File "/django_virtalenv//lib/python2.7/site-packages/django/contrib/admin/options.py", line 1263, in change_view self.save_model(request, new_object, form, True)
 File "/data/cms/trunk/cms/articles/admin.py", line 125, in save_model obj.save()
 File "/django_virtalenv//lib/python2.7/site-packages/django/db/models/base.py", line 545, in save force_update=force_update, update_fields=update_fields)
 File "/django_virtalenv//lib/python2.7/site-packages/django/db/models/base.py", line 573, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
 File "/django_virtalenv//lib/python2.7/site-packages/django/db/models/base.py", line 632, in _save_table for f in non_pks]
 File "/django_virtalenv//lib/python2.7/site-packages/django/db/models/fields/files.py", line 252, in pre_save file.save(file.name, file, save=False)
 File "/data/cms/trunk/cms/utils/thumbs.py", line 93, in save thumb_content = generate_thumb( content, size, split[1] )
 File "/data/cms/trunk/cms/utils/thumbs.py", line 60, in generate_thumb image2.save( io, "JPEG", quality = 90, optimize=True, progressive=True)
 File "/django_virtalenv//lib/python2.7/site-packages/PIL/Image.py", line 1439, in save save_handler(self, fp, filename)
 File "/django_virtalenv//lib/python2.7/site-packages/PIL/JpegImagePlugin.py", line 471, in _save Image
 File._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
 File "/django_virtalenv//lib/python2.7/site-packages/PIL/Image
 File.py", line 491, in _save raise IOError("encoder error %d when writing image file" % s)IOError: encoder error -2 when writing image file

Soln :- pip install Pillow

1 comment:

Wheelchair India said...

Hey, very nice site. I came across this on Google, and I am stoked that I did. I will definitely be coming back here more often. Wish I could add to the conversation and bring a bit more to the table, but am just taking in as much info as I can at the moment. Thanks for sharing.
BTE Hearing Aid Prices

Keep Posting:)