{"action":"opened","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/10670","labels_url":"https://api.github.com/repos/odoo/odoo/issues/10670/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/10670/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/10670/events","html_url":"https://github.com/odoo/odoo/issues/10670","id":129588693,"number":10670,"title":"[8.0] can't import dateparser from an Odoo module","user":{"login":"alexis-via","id":1157917,"avatar_url":"https://avatars.githubusercontent.com/u/1157917?v=3","gravatar_id":"","url":"https://api.github.com/users/alexis-via","html_url":"https://github.com/alexis-via","followers_url":"https://api.github.com/users/alexis-via/followers","following_url":"https://api.github.com/users/alexis-via/following{/other_user}","gists_url":"https://api.github.com/users/alexis-via/gists{/gist_id}","starred_url":"https://api.github.com/users/alexis-via/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexis-via/subscriptions","organizations_url":"https://api.github.com/users/alexis-via/orgs","repos_url":"https://api.github.com/users/alexis-via/repos","events_url":"https://api.github.com/users/alexis-via/events{/privacy}","received_events_url":"https://api.github.com/users/alexis-via/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-28T21:31:27Z","updated_at":"2016-01-28T21:31:27Z","closed_at":null,"body":"Here are the steps to reproduce the bug:\r\n1) install the dateparser python lib:\r\n```\r\nsudo pip install dateparser\r\n```\r\n2) Unzip the module bug_dateparser available from https://people.via.ecp.fr/~alexis/bug_dateparser.zip in a directory of your addons path. This is a very simple module that only does the following:\r\n```\r\nimport dateparser\r\n```\r\n3) Update module list, then install the module bug_dateparser: you get a crash:\r\n```\r\n2016-01-28 21:13:23,200 3940 INFO o8_test1 openerp.modules.loading: loading 92 modules...\r\n2016-01-28 21:13:23,265 3940 CRITICAL o8_test1 openerp.modules.module: Couldn't load module bug_dateparser\r\n2016-01-28 21:13:23,266 3940 CRITICAL o8_test1 openerp.modules.module: find_module() takes exactly 3 arguments (2 given)\r\n> /usr/lib/python2.7/pkgutil.py(475)find_loader()\r\n-> loader = importer.find_module(fullname)\r\n(Pdb) bt\r\n  /home/alexis/new_boite/dev/odoo8/openerp/http.py(574)dispatch()\r\n-> result = self._call_function(**self.params)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/http.py(310)_call_function()\r\n-> return checked_call(self.db, *args, **kwargs)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/service/model.py(118)wrapper()\r\n-> return f(dbname, *args, **kwargs)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/http.py(307)checked_call()\r\n-> return self.endpoint(*a, **kw)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/http.py(803)__call__()\r\n-> return self.method(*args, **kw)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/http.py(403)response_wrap()\r\n-> response = f(*args, **kw)\r\n  /home/alexis/new_boite/dev/odoo8/addons/web/controllers/main.py(948)call_button()\r\n-> action = self._call_kw(model, method, args, {})\r\n  /home/alexis/new_boite/dev/odoo8/addons/web/controllers/main.py(936)_call_kw()\r\n-> return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/api.py(268)wrapper()\r\n-> return old_api(self, *args, **kwargs)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/addons/base/module/module.py(448)button_immediate_install()\r\n-> return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/api.py(268)wrapper()\r\n-> return old_api(self, *args, **kwargs)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/addons/base/module/module.py(496)_button_immediate_function()\r\n-> registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/modules/registry.py(370)new()\r\n-> openerp.modules.load_modules(registry._db, force_demo, status, update_module)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/modules/loading.py(355)load_modules()\r\n-> loaded_modules, update_module)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/modules/loading.py(255)load_marked_modules()\r\n-> loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/modules/loading.py(143)load_module_graph()\r\n-> load_openerp_module(package.name)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/modules/module.py(315)load_openerp_module()\r\n-> __import__('openerp.addons.' + module_name)\r\n  /home/alexis/new_boite/dev/odoo8/openerp/modules/module.py(80)load_module()\r\n-> mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)\r\n  /home/alexis/new_boite/dev/test8/bug_dateparser/__init__.py(3)<module>()\r\n-> from . import bug\r\n  /home/alexis/new_boite/dev/test8/bug_dateparser/bug.py(21)<module>()\r\n-> import dateparser\r\n  /usr/local/lib/python2.7/dist-packages/dateparser-0.3.2-py2.7.egg/dateparser/__init__.py(4)<module>()\r\n-> from .date import DateDataParser\r\n  /usr/local/lib/python2.7/dist-packages/dateparser-0.3.2-py2.7.egg/dateparser/date.py(11)<module>()\r\n-> from dateparser.date_parser import date_parser\r\n  /usr/local/lib/python2.7/dist-packages/dateparser-0.3.2-py2.7.egg/dateparser/date_parser.py(16)<module>()\r\n-> from .conf import apply_settings\r\n  /usr/local/lib/python2.7/dist-packages/dateparser-0.3.2-py2.7.egg/dateparser/conf.py(61)<module>()\r\n-> settings = Settings()\r\n  /usr/local/lib/python2.7/dist-packages/dateparser-0.3.2-py2.7.egg/dateparser/conf.py(31)__init__()\r\n-> self._updateall(self._get_settings_from_yaml().items())\r\n  /usr/local/lib/python2.7/dist-packages/dateparser-0.3.2-py2.7.egg/dateparser/conf.py(44)_get_settings_from_yaml()\r\n-> data = get_data('data', 'settings.yaml')\r\n  /usr/lib/python2.7/pkgutil.py(578)get_data()\r\n-> loader = get_loader(package)\r\n  /usr/lib/python2.7/pkgutil.py(464)get_loader()\r\n-> return find_loader(fullname)\r\n> /usr/lib/python2.7/pkgutil.py(475)find_loader()\r\n-> loader = importer.find_module(fullname)\r\n```\r\n\r\nThis is a real problem for me, because the lib invoice2data that is used in my module account_invoice_import (cf this PR https://github.com/OCA/account-invoicing/pull/122) now uses dateparser, so, if you have the latest version of invoice2data, you won't be able to install the module account_invoice_import :-(\r\n\r\nI don't know if this bug is Odoo's fault or dateparser's fault. I have some difficulty to understand the exact cause of the problem. One thing I noticed:\r\n\r\n* in /usr/lib/python2.7/pkgutil.py, we have a find_module method with 3 args and the third has a default value, so it can be called with only 2 args:\r\n```\r\ndef find_module(self, fullname, path=None)\r\n```\r\n\r\n* in odoo/openerp/module/module.py (cf https://github.com/odoo/odoo/blob/8.0/openerp/modules/module.py#L68) we have the same method with 3 args and the 3rd one doesn't have a default value so it has to be called with 3 args:\r\n```\r\ndef find_module(self, module_name, package_path):\r\n```\r\nSo I was thinking it may be mixing the two... but I really don't understand what's happening, so I may be completely wrong.\r\n"}}