Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Error when Uploading Jpgs to a user profile. Where is the problem?

By
Stefan Pütz
on 10/28/14, 6:48 AM 1,981 views

Hi there,
I installed Odoo 8 from git repository on a ubuntu 14.04 server. It runs fine but uploading a Jpg file to a user profile fails with an error message. PNG files can be uploaded without a problem. I think I installed all necessary libraries, especially Python Image Libraries.
Is there a bug in Odoo or is there a problem with a wrong Python library version?
Here is the error message I receive when trying to save an uploaded jpg file to a user profile.
 

OpenERP Server Error

Traceback (most recent call last): File "/opt/odoo/openerp/http.py", line 500, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo/openerp/http.py", line 517, in dispatch result = self._call_function(**self.params) File "/opt/odoo/openerp/http.py", line 283, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo/openerp/service/model.py", line 113, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo/openerp/http.py", line 280, in checked_call return self.endpoint(*a, **kw) File "/opt/odoo/openerp/http.py", line 733, in __call__ return self.method(*args, **kw) File "/opt/odoo/openerp/http.py", line 376, in response_wrap response = f(*args, **kw) File "/opt/odoo/addons/web/controllers/main.py", line 948, in call_kw return self._call_kw(model, method, args, kwargs) File "/opt/odoo/addons/web/controllers/main.py", line 940, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/addons/mail/res_users.py", line 172, in write write_res = super(res_users_mail_group, self).write(cr, uid, ids, vals, context=context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/addons/base/res/res_users.py", line 810, in write return super(users_view, self).write(cr, uid, ids, values, context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/addons/base/res/res_users.py", line 633, in write res = super(users_implied, self).write(cr, uid, ids, values, context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/addons/base/res/res_users.py", line 326, in write res = super(res_users, self).write(cr, uid, ids, values, context=context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 360, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 3668, in write self._write(old_vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 552, in new_api result = method(self._model, cr, uid, self.ids, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 3832, in _write self.pool[table].write(cr, user, nids, v, context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 360, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/openerp/addons/base/res/res_partner.py", line 552, in write result = super(res_partner, self).write(vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 552, in new_api result = method(self._model, cr, uid, self.ids, *args, **kwargs) File "/opt/odoo/addons/mail/mail_thread.py", line 427, in write result = super(mail_thread, self).write(cr, uid, ids, values, context=context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 360, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 3668, in write self._write(old_vals) File "/opt/odoo/openerp/api.py", line 235, in wrapper return new_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 552, in new_api result = method(self._model, cr, uid, self.ids, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 3911, in _write self.pool[model_name]._store_set_values(cr, user, todo, fields_to_recompute, context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/models.py", line 4278, in _store_set_values result = self._columns[val[0]].get(cr, self, ids, val, SUPERUSER_ID, context=context) File "/opt/odoo/openerp/osv/fields.py", line 1354, in get result = self._fnct(obj, cr, uid, ids, name, self._arg, context) File "/opt/odoo/openerp/api.py", line 237, in wrapper return old_api(self, *args, **kwargs) File "/opt/odoo/openerp/api.py", line 360, in old_api result = method(recs, *args, **kwargs) File "/opt/odoo/openerp/addons/base/res/res_partner.py", line 187, in _get_image return dict((p.id, tools.image_get_resized_images(p.image)) for p in self) File "/opt/odoo/openerp/addons/base/res/res_partner.py", line 187, in <genexpr> return dict((p.id, tools.image_get_resized_images(p.image)) for p in self) File "/opt/odoo/openerp/tools/image.py", line 218, in image_get_resized_images return_dict[medium_name] = image_resize_image_medium(base64_source, avoid_if_small=avoid_resize_medium) File "/opt/odoo/openerp/tools/image.py", line 156, in image_resize_image_medium return image_resize_image(base64_source, size, encoding, filetype, avoid_if_small) File "/opt/odoo/openerp/tools/image.py", line 91, in image_resize_image image = image_resize_and_sharpen(image, size) File "/opt/odoo/openerp/tools/image.py", line 110, in image_resize_and_sharpen image = image.convert('RGBA') File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 713, in convert self.load() File "/usr/lib/python2.7/dist-packages/PIL/ImageFile.py", line 234, in load raise_ioerror(e) File "/usr/lib/python2.7/dist-packages/PIL/ImageFile.py", line 56, in raise_ioerror raise IOError(message + " when reading image file") IOError: broken data stream when reading image file

Maybe someone can help.

Greetings
Stefan

0
Stefan Pütz
On 10/28/14, 7:30 AM

Hi,

thank you for your answer.

I installed libjpeg8-dev and reinstalled PIL via pip. I removed the PIL package which is brought by ubuntu to ensure the PIL from pip is used. Here is the output of reinstalling:

-------------------------------------------------------------------- PIL SETUP SUMMARY --------------------------------------------------------------------

version Pillow 2.6.1 platform linux2 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2]

--------------------------------------------------------------------

TKINTER support not available (Tcl/Tk 8.6 libraries needed) ---
JPEG support available ***
OPENJPEG (JPEG2000) support not available ---
ZLIB (PNG/ZIP) support available ***
LIBTIFF support not available ---
FREETYPE2 support available ***
LITTLECMS2 support not available ***
WEBP support not available ***
WEBPMUX support not available
--------------------------------------------------------------------

It seems that jpg is activated correctly. But that did not fix the problem.

Try to use PIL 1.1.7 from http://www.pythonware.com/products/pil/

Med Said BARA
on 10/28/14, 8:54 AM

Read the README file for how to build, and it seems that you should use libjpeg 6.

Med Said BARA
on 10/28/14, 8:58 AM

Yeah thanks! It seems to work now. The solution is to remove the ubuntu python-pil package. Then remove the ubuntu libjpeg8-dev package and install the libjpeg62-dev package. Then I built PIL via pip which now uses the libjpeg62-dev instead of libjpeg8-dev. Great ;)

Stefan Pütz
on 10/28/14, 9:33 AM
0

Med Said BARA

--Med Said BARA--
2664
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 10/28/14, 7:17 AM

Just ry to convert your .jpg to .png

Or  install libjpeg8-dev and rebuild and reinstall PIL.

Hi, thank you for your answer. I installed libjpeg8-dev and reinstalled PIL via pip. I removed the PIL package which is brought by ubuntu to ensure the PIL from pip is used. Here is the output of reinstalling: -------------------------------------------------------------------- PIL SETUP SUMMARY -------------------------------------------------------------------- version Pillow 2.6.1 platform linux2 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] -------------------------------------------------------------------- *** TKINTER support not available (Tcl/Tk 8.6 libraries needed) --- JPEG support available *** OPENJPEG (JPEG2000) support not available --- ZLIB (PNG/ZIP) support available *** LIBTIFF support not available --- FREETYPE2 support available *** LITTLECMS2 support not available *** WEBP support not available *** WEBPMUX support not available -------------------------------------------------------------------- It seems that jpg is activated correctly. But that did not fix the problem.

Stefan Pütz
on 10/28/14, 7:31 AM

Do you get the same error message after reinstalling PIl with pip ??? In your log the error is coming from : ...../dist-packages/PIL/ImageFile.py", line 56,....... But in the install message after pip install ..... it shows version Pillow 2.6.1 platform linux2 2.7.6 .... could you post the new openerp-server.log

Med Said BARA
on 10/28/14, 8:51 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/28/14, 6:48 AM
Seen: 1981 times
Last updated: 3/16/15, 8:10 AM