From 84c8896bda193e8b40ae404e3fddc085ff865474 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Wed, 25 Mar 2015 09:25:28 +0100 Subject: [PATCH] protect import of external dependencies Odoo won't install an addon if the external dependencies are not met. However, the python modules of the addons are imported at startup, and the lack of an external dependency for an external addon will cause a crash, therefore the import needs to be in a try..except block. closes #100 --- base_location_geonames_import/wizard/geonames_import.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/base_location_geonames_import/wizard/geonames_import.py b/base_location_geonames_import/wizard/geonames_import.py index 51c6b07b6..a3535be8f 100644 --- a/base_location_geonames_import/wizard/geonames_import.py +++ b/base_location_geonames_import/wizard/geonames_import.py @@ -27,11 +27,15 @@ from openerp.exceptions import Warning import requests import tempfile import StringIO -import unicodecsv import zipfile import os import logging +try: + import unicodecsv +except ImportError: + unicodecsv = None + logger = logging.getLogger(__name__)