From eee4075fe8e967b7d643bb39e6a833c3036fce63 Mon Sep 17 00:00:00 2001 From: DeWitt Clinton Date: Tue, 29 Aug 2006 15:47:42 -0700 Subject: [PATCH] OSX has a problem with the form: __import__('a/b/c') Replaced with a variation of: sys.path.append(os.path.join('a','b')) __import__('c') --- planet/shell/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/planet/shell/__init__.py b/planet/shell/__init__.py index 0847417..554cddb 100644 --- a/planet/shell/__init__.py +++ b/planet/shell/__init__.py @@ -1,5 +1,6 @@ import planet import os +import sys def run(template_file, doc): """ select a template module based on file extension and execute it """ @@ -11,14 +12,14 @@ def run(template_file, doc): else: return log.error("Unable to locate template %s", template_file) + sys.path.append(os.path.join('planet','shell')) + base,ext = os.path.splitext(os.path.basename(template_resolved)) try: - template_module_name = os.path.join('planet', 'shell', ext[1:]) + template_module_name = ext[1:] template_module = __import__(template_module_name) - except ImportError, inst: - return log.error("Skipping template '%s' after failing to load '%s': %s", template_resolved, template_module_name, inst) except Exception, inst: - return log.error("Unknown exception: %s", inst) + return log.error("Skipping template '%s' after failing to load '%s': %s", template_resolved, template_module_name, inst) log.info("Processing template %s from %s", template_resolved, template_module_name) output_dir = planet.config.output_dir()