← Back to team overview

openerp-india team mailing list archive

[Bug 930550] Re: 'import Image' instead of 'from PIL import Image' in point_of_sale.py

 

Problem is that this is not working everywhere.

And why is this the "clean" way of importing?

Import Image is what the documentation says:

http://www.pythonware.com/library/pil/handbook/introduction.htm

I had to revert this patch/update to get my server starting again...

Because of this error:

Traceback (most recent call last):
  File "/home/oervwncrmtst61/oervwncrmtst61-openerp-server", line 252, in <module>
    openerp.modules.module.load_openerp_module(m)
  File "/home/oervwncrmtst61/bzr/openobject-server/openerp/modules/module.py", line 419, in load_openerp_module
    getattr(sys.modules['openerp.addons.' + module_name], info['post_load'])()
  File "/home/oervwncrmtst61/openerp-web/addons/web/__init__.py", line 29, in wsgi_postload
    app = common.http.Root(o)
  File "/home/oervwncrmtst61/openerp-web/addons/web/common/http.py", line 453, in __init__
    static_dirs = self._load_addons(openerp_addons_namespace)
  File "/home/oervwncrmtst61/openerp-web/addons/web/common/http.py", line 523, in _load_addons
    m = __import__('openerp.addons.' + module)
  File "/home/oervwncrmtst61/bzr/openobject-server/openerp/modules/module.py", line 139, in load_module
    mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
  File "/home/oervwncrmtst61/openobject-addons/point_of_sale/__init__.py", line 22, in <module>
    import point_of_sale
  File "/home/oervwncrmtst61/openobject-addons/point_of_sale/point_of_sale.py", line 26, in <module>
    from PIL import Image
ImportError: No module named PIL

Solved by making this edit:
# vim /home/oervwncrmtst61/openobject-addons/point_of_sale/point_of_sale.py

 25 import logging
 26 # Patch 2012-02-20 Ronald Portier
 27 # from PIL import Image
 28 import Image

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/930550

Title:
  'import Image' instead of 'from PIL import Image'  in point_of_sale.py

Status in OpenERP Addons (modules):
  Fix Released

Bug description:
  While 'import Image' works with the standard PIL installation, it is
  not supported and not compatible Pillow, the friendly PIL fork.

  PIL is imported correctly in all other places:
  find -name "*.py" -print0 |xargs -0 grep 'import Image'

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/930550/+subscriptions


Follow ups

References