New submission from Chris Jerdonek <chris.jerdo...@gmail.com>: It would be nice if the error message for an AttributeError could include the module name when getting from a module -- just like it does for getting from a class.
This would make the message more helpful. For example, it would help in diagnosing issues like the ones mentioned in this report: http://bugs.python.org/issue7559 EXAMPLE (using latest from trunk Python 2.7a4+): import sys class TestClass(object): pass m = sys c = TestClass print "CLASS: %s" % c try: c.asdf except AttributeError, err: print err print "\nMODULE: %s" % m try: m.adsf except AttributeError, err: print err *** OUTPUT: CLASS: <class '__main__.TestClass'> type object 'TestClass' has no attribute 'asdf' MODULE: <module 'sys' (built-in)> 'module' object has no attribute 'adsf' *** The latter message could instead be (paralleling the text in the case of a class)-- module object 'sys' has no attribute 'adsf' ---------- components: Library (Lib) messages: 102224 nosy: cjerdonek severity: normal status: open title: AttributeError message text should include module name type: feature request versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8297> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com