Skip to content

Commit 2cf593f

Browse files
author
Allan Lei
committed
Replace __import__ with imp.load_source
1 parent 9c80f36 commit 2cf593f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

gorun.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def configure_more(directories):
169169

170170
if __name__=='__main__':
171171
import sys
172+
import imp
172173
args = sys.argv[1:]
173174
if not args and os.path.isfile('gorun_settings.py'):
174175
print >>sys.stderr, "Guessing you want to use gorun_settings.py"
@@ -183,11 +184,9 @@ def configure_more(directories):
183184

184185

185186
settings_file = args[-1]
186-
if settings_file.endswith('.py'):
187-
settings_file = settings_file[:-3]
188187

189188
sys.path.append(os.path.abspath(os.curdir))
190-
x = __import__(settings_file)
189+
x = imp.load_source('gorun_settings', settings_file)
191190
settings.DIRECTORIES = x.DIRECTORIES
192191
settings.VERBOSE = getattr(x, 'VERBOSE', settings.VERBOSE)
193192
settings.IGNORE_EXTENSIONS = getattr(x, 'IGNORE_EXTENSIONS', tuple())

0 commit comments

Comments
 (0)