]> granicus.if.org Git - python/commitdiff
SF bug #652933 (for IdleFork): Open Module "math" Fails (Hettinger)
authorKurt B. Kaiser <kbk@shore.net>
Fri, 10 Jan 2003 21:25:20 +0000 (21:25 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Fri, 10 Jan 2003 21:25:20 +0000 (21:25 +0000)
When a module doesn't have a __path__ attribute, trigger a dialog box
rather than dumping a traceback to the console.

Synch to Python IDLE.

Lib/idlelib/EditorWindow.py

index af60eca0b496704bb581f65118477fc812f807d7..b940c3bbd297c20e8445514fa81477bbe15ae9a7 100644 (file)
@@ -30,7 +30,10 @@ def _find_module(fullname, path=None):
         if descr[2] == imp.PY_SOURCE:
             break                   # find but not load the source file
         module = imp.load_module(tgt, file, filename, descr)
-        path = module.__path__
+        try:
+            path = module.__path__
+        except AttributeError:
+            raise ImportError, 'No source for module ' + module.__name__
     return file, filename, descr
 
 class EditorWindow: