Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 6e103ac

Browse files
committed
Merge pull request #82 from viorelsfetea/master
Update pipeline module import to no longer fail on ImportError, but if the module doesn't exist
2 parents dcc2b8a + 42f245e commit 6e103ac

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

python/src/mapreduce/base_handler.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,20 @@
2222
# pylint: disable=g-import-not-at-top
2323

2424
import httplib
25+
import importlib
2526
import logging
27+
import pkgutil
2628

2729
try:
2830
import json
2931
except ImportError:
3032
import simplejson as json
3133

32-
try:
33-
from mapreduce import pipeline_base
34-
except ImportError:
35-
pipeline_base = None
34+
pipeline_base = None
35+
36+
if pkgutil.find_loader('mapreduce.pipeline_base') is not None:
37+
pipeline_base = importlib.import_module('mapreduce.pipeline_base')
38+
3639
try:
3740
# Check if the full cloudstorage package exists. The stub part is in runtime.
3841
import cloudstorage

0 commit comments

Comments
 (0)