← Back to team overview

openerp-india team mailing list archive

[Bug 1088861] Re: Ambiguous import: project_issue module incompatible with Pacemaker cluster management

 

@serpent-consulting-services: what is expected is that certified addons
perform relative imports or fully qualified imports.

As said in the Zen of Python:

    Namespaces are one honking great idea -- let's do more of those!

so using a raw "import crm" inside an OpenERP addon is wrong. Using
"from .crm import crm" would solve thhe issue.

-- 
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/1088861

Title:
  Ambiguous import: project_issue module incompatible with Pacemaker
  cluster management

Status in OpenERP Addons (modules):
  Confirmed

Bug description:
  In the current trunk, the CRM module is imported with:
      from crm import crm
  Unfortunately, there already is a Python package named "crm" that's part of Pacemaker (where "CRM" stands for "Cluster Resource Manager").

  
  Console output of the server :
  2012-12-11 11:02:19,818 1094 INFO ? openerp: OpenERP version 7.0alpha
  2012-12-11 11:02:19,819 1094 INFO ? openerp: addons paths: /home/ubuntu/server/openerp/addons,/home/ubuntu/addons,/home/ubuntu/web/addons
  2012-12-11 11:02:19,819 1094 INFO ? openerp: database hostname: localhost
  2012-12-11 11:02:19,819 1094 INFO ? openerp: database port: 5432
  2012-12-11 11:02:19,819 1094 INFO ? openerp: database user: ubuntu
  2012-12-11 11:02:23,237 1094 WARNING ? openerp.modules.module: 
  Ambiguous import: the OpenERP module `crm` is shadowed by another
  module (available at /usr/lib/python2.7/dist-packages/crm).
  To import it, use `import openerp.addons.<module>.`.
  2012-12-11 11:02:23,240 1094 CRITICAL ? openerp.modules.module: Couldn't load module web
  2012-12-11 11:02:23,240 1094 CRITICAL ? openerp.modules.module: cannot import name crm
  2012-12-11 11:02:23,241 1094 ERROR ? openerp.service: Failed to load server-wide module `web`.
  The `web` module is provided by the addons found in the `openerp-web` project.
  Maybe you forgot to add those addons in your addons_path configuration.
  Traceback (most recent call last):
    File "/home/ubuntu/server/openerp/service/__init__.py", line 54, in load_server_wide_modules
      openerp.modules.module.load_openerp_module(m)
    File "/home/ubuntu/server/openerp/modules/module.py", line 414, in load_openerp_module
      getattr(sys.modules['openerp.addons.' + module_name], info['post_load'])()
    File "/home/ubuntu/web/addons/web/http.py", line 593, in wsgi_postload
      openerp.wsgi.register_wsgi_handler(Root())
    File "/home/ubuntu/web/addons/web/http.py", line 482, in __init__
      static_dirs = self._load_addons()
    File "/home/ubuntu/web/addons/web/http.py", line 549, in _load_addons
      m = __import__('openerp.addons.' + module)
    File "/home/ubuntu/server/openerp/modules/module.py", line 133, in load_module
      mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
    File "/home/ubuntu/addons/project_issue/__init__.py", line 23, in <module>
      import project_issue
    File "/home/ubuntu/addons/project_issue/project_issue.py", line 23, in <module>
      from crm import crm
  ImportError: cannot import name crm

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


References