← Back to team overview

openerp-connector-community team mailing list archive

Multiprocessing connector worker and queue import trouble

 

Hi all,

I am running the connector with multiprocessing as outlined on [1]. In
my OpenERP database there is a certain module installed that indirectly
requires urllib3 from the Python standard library. The file
'connectionpool' from urllib3 needs the Queue/queue class from the
Python standard library and because of Python 2/3 issues it first tries
to import 'queue' before importing 'Queue'. However, the import finds a
'queue' class, namely the one from the connector. This in turn causes a
ValueError during the import as the exception trace below shows [2].
This problem seems to occur only in the connector, OpenERP itself is
running fine.
Has somebody already encountered this problem or do you have ideas for a
good solution? Or is it even a problem with the Python standard library?
There also is a similar question on help.openerp.com [3].
I mitigated this issue by patching urllib3/connectionpool.py from the
standard library, but this is not an optimal solution.

Best,
 Thomas.

[1] http://openerp-connector.com/guides/multiprocessing.html

[2]
2014-04-16 14:18:53,113 8631 CRITICAL testdb openerp.modules.module:
Couldn't load module bank_integration_paypal
2014-04-16 14:18:53,113 8631 ERROR testdb openerp.modules.module:
Attempted relative import beyond toplevel package
Traceback (most recent call last):
  File "/srv/openerp/server/openerp/modules/module.py", line 405, in
load_openerp_module
    __import__('openerp.addons.' + module_name)
  File "/srv/openerp/server/openerp/modules/module.py", line 133, in
load_module
    mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
  File
"/srv/openerp/addons/customer-addons/bank_integration_paypal/__init__.py",
line 3, in <module>
    from . import bank_importer_paypal
  File
"/srv/openerp/addons/customer-addons/bank_integration_paypal/bank_importer_paypal.py",
line 25, in <module>
    from paypal import PayPalInterface, PayPalConfig, PayPalAPIResponseError
  File "/usr/local/lib/python2.7/dist-packages/paypal/__init__.py", line
3, in <module>
    from paypal.interface import PayPalInterface
  File "/usr/local/lib/python2.7/dist-packages/paypal/interface.py",
line 12, in <module>
    import requests
  File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 26,
in <module>
    from .models import Request, Response
  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 20,
in <module>
    from .packages.urllib3.response import HTTPResponse
  File "/usr/lib/python2.7/dist-packages/requests/packages/__init__.py",
line 3, in <module>
    from . import urllib3
  File
"/usr/lib/python2.7/dist-packages/requests/packages/urllib3/__init__.py", line
16, in <module>
    from .connectionpool import (
  File
"/usr/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py",
line 20, in <module>
    from queue import LifoQueue, Empty, Full
  File
"/srv/openerp/addons/petspremium-addons-external/connector/queue/__init__.py",
line 22, in <module>
    import model
  File
"/srv/openerp/addons/petspremium-addons-external/connector/queue/model.py",
line 30, in <module>
    from .job import STATES, DONE, PENDING, OpenERPJobStorage
  File
"/srv/openerp/addons/petspremium-addons-external/connector/queue/job.py", line
33, in <module>
    from ..exception import (NotReadableJobError,
ValueError: Attempted relative import beyond toplevel package

[3]
http://help.openerp.com/question/49235/how-to-launch-connector-with-multi-worker/


Follow ups