"Neal Norwitz" <[EMAIL PROTECTED]> wrote: > > On 8/9/06, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > 2.4 performed these imports silently, while 2.5 complains "SystemError: > > Parent module 'x' not loaded", which is actually a useful message, and > > helped me fix it. > > Can you make a small, self-contained test case? The SystemError > should be a normal exception and might indicate a deeper problem.
Create a module z.py whose contents are: #z.py import sys import imp sys.stdout = None try: y = imp.load_source('x.y', 'x/y.py', open('x/y.py')) except: raise else: print "printing should raise an AttributeError, but doesn't" #end of listing for z.py Create a module x/y.py whose contents are: (x/__init__.py not required) #x/y.py import sys #end of listing for x/y.py Running z.py in Python 2.3 and 2.4 produces: printing should raise an AttributeError, but doesn't Running z.py in Python 2.5b2 produces: Traceback (most recent call last): File "test.py", line 7, in <module> y = imp.load_source('x.y', 'x/y.py', open('x/y.py')) File "x/y.py", line 1, in <module> import sys SystemError: Parent module 'x' not loaded - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com