From: Raymond Hettinger Date: Wed, 13 Apr 2011 01:30:14 +0000 (-0700) Subject: Issue 11718: Teach IDLE's open module dialog to find packages. X-Git-Tag: v3.2.1b1~138^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f6445e8f4179cbf8825a9d873800c44f9687e229;p=thirdparty%2FPython%2Fcpython.git Issue 11718: Teach IDLE's open module dialog to find packages. --- diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index ffc4e88d9d45..3b7bb6df6f05 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -50,6 +50,17 @@ def _find_module(fullname, path=None): path = module.__path__ except AttributeError: raise ImportError('No source for module ' + module.__name__) + if descr[2] != imp.PY_SOURCE: + # If all of the above fails and didn't raise an exception,fallback + # to a straight import which can find __init__.py in a package. + m = __import__(fullname) + try: + filename = m.__file__ + except AttributeError: + pass + else: + file = None + descr = os.path.splitext(filename), None, imp.PY_SOURCE return file, filename, descr class EditorWindow(object): diff --git a/Misc/NEWS b/Misc/NEWS index af3ad9ac9a61..253f8543d092 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -224,6 +224,12 @@ Build - Issue #11268: Prevent Mac OS X Installer failure if Documentation package had previously been installed. +IDLE +---- + +- Issue #11718: IDLE's open module dialog couldn't find the __init__.py + file in a package. + Tools/Demos -----------