From 3984a5cee470fa579f1f0a0c5962d274dcb3d40a Mon Sep 17 00:00:00 2001 From: Viorel Sfetea Date: Tue, 17 Nov 2015 14:24:37 +0200 Subject: [PATCH 1/2] Update pipeline module import to no longer fail on ImportError, but if the module doesn't exist --- python/src/mapreduce/base_handler.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/src/mapreduce/base_handler.py b/python/src/mapreduce/base_handler.py index bc3fb727..3b6d6430 100755 --- a/python/src/mapreduce/base_handler.py +++ b/python/src/mapreduce/base_handler.py @@ -23,16 +23,19 @@ import httplib import logging +import pkgutil +import importlib try: import json except ImportError: import simplejson as json -try: - from mapreduce import pipeline_base -except ImportError: - pipeline_base = None +pipeline_base = None + +if pkgutil.find_loader('mapreduce.pipeline_base') is not None: + pipeline_base = importlib.import_module('mapreduce.pipeline_base') + try: # Check if the full cloudstorage package exists. The stub part is in runtime. import cloudstorage From 42f245ec8d3f2f76f345fa9aec5999e268ccd1d4 Mon Sep 17 00:00:00 2001 From: "viorel.sfetea" Date: Fri, 19 Feb 2016 09:48:35 +0200 Subject: [PATCH 2/2] Update import order, packages are now ordered lexicographically --- python/src/mapreduce/base_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/src/mapreduce/base_handler.py b/python/src/mapreduce/base_handler.py index 3b6d6430..8f77480d 100755 --- a/python/src/mapreduce/base_handler.py +++ b/python/src/mapreduce/base_handler.py @@ -22,9 +22,9 @@ # pylint: disable=g-import-not-at-top import httplib +import importlib import logging import pkgutil -import importlib try: import json