summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJosh Blum2013-08-26 21:52:47 -0700
committerJosh Blum2013-08-30 08:57:16 -0700
commit021ae565d85f97925001349cfe69a76f288d07d7 (patch)
treee14135d1fa10fc052e5df07af6292ac019584067 /python
parent038511cdbb65805d786385a25ed7a811910606c6 (diff)
downloadsandhi-021ae565d85f97925001349cfe69a76f288d07d7.tar.gz
sandhi-021ae565d85f97925001349cfe69a76f288d07d7.tar.bz2
sandhi-021ae565d85f97925001349cfe69a76f288d07d7.zip
gras: use python's internal import module
Diffstat (limited to 'python')
-rw-r--r--python/gras/GRAS_Loader.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/python/gras/GRAS_Loader.py b/python/gras/GRAS_Loader.py
index cc73d9b..f8db82e 100644
--- a/python/gras/GRAS_Loader.py
+++ b/python/gras/GRAS_Loader.py
@@ -1,24 +1,20 @@
# Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.
import os
-import sys
+import imp
import traceback
#try to import module
-#http://effbot.org/zone/import-string.htm
def __try_module_import(filename):
directory, module_name = os.path.split(filename)
module_name = os.path.splitext(module_name)[0]
- path = list(sys.path)
- sys.path.insert(0, directory)
try:
- module = __import__(module_name)
+ fp, pathname, description = imp.find_module(module_name, [directory])
+ module = imp.load_module(module_name, fp, pathname, description)
except Exception as ex:
print 'Could not import', filename, ex
print traceback.format_exc()
- finally:
- sys.path[:] = path # restore
#recursive search for modules in path
def __module_import(p):