Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 69e8afc

Browse files
committed
SF bug #652933 (for IdleFork): Open Module "math" Fails (Hettinger)
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.
1 parent df8b47f commit 69e8afc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/idlelib/EditorWindow.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def _find_module(fullname, path=None):
3030
if descr[2] == imp.PY_SOURCE:
3131
break # find but not load the source file
3232
module = imp.load_module(tgt, file, filename, descr)
33-
path = module.__path__
33+
try:
34+
path = module.__path__
35+
except AttributeError:
36+
raise ImportError, 'No source for module ' + module.__name__
3437
return file, filename, descr
3538

3639
class EditorWindow:

0 commit comments

Comments
 (0)