From fb50d06175bd7c8c4a3feccef6dfef956a5b4c29 Mon Sep 17 00:00:00 2001 From: giovannibajo Date: Fri, 22 May 2009 18:51:07 +0000 Subject: [PATCH] The internal consistency errors of importHook() shouldn't be ImportErrors, otherwise they get swallowed just like the import failed. Instead, they notify there's something wrong with the logic of PyInstaller. Make them cry through RuntimeErrors. git-svn-id: http://svn.pyinstaller.org/trunk@670 8dd32b29-ccff-0310-8a9a-9233e24343b1 --- iu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iu.py b/iu.py index 2f4eb29..f13ef42 100644 --- a/iu.py +++ b/iu.py @@ -373,7 +373,7 @@ class ImportManager: if globals: __globals_name = globals.get('__name__') # first see if we could be importing a relative name - debug("importHook(%s, %s, locals, %s)" % (name, __globals_name, fromlist)) + debug("importHook(%s, %s, locals, %s, %s)" % (name, __globals_name, fromlist, level)) _sys_modules_get = sys.modules.get _self_doimport = self.doimport threaded = self.threaded @@ -385,7 +385,7 @@ class ImportManager: if not globals: contexts = [None] if level >= 0: - raise ImportError("Relative import requires 'globals'") + raise RuntimeError("Relative import requires 'globals'") elif level == 0: # absolute import, do not try relative contexts = [None] @@ -399,7 +399,7 @@ class ImportManager: else: # relative import, do not try absolute if not importernm: - raise ImportError("Relative import requires package") + raise RuntimeError("Relative import requires package") importernm = _string_split(importernm, '.')[:-level] importernm = _string_join('.', importernm) contexts = []