Message102224
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' | |
| Date | User | Action | Args | | 2010-04-03 05:30:08 | chris.jerdonek | set | recipients: + chris.jerdonek | | 2010-04-03 05:30:07 | chris.jerdonek | set | messageid: <1270272607.93.0.943961280816.issue8297@psf.upfronthosting.co.za> | | 2010-04-03 05:30:05 | chris.jerdonek | link | issue8297 messages | | 2010-04-03 05:30:04 | chris.jerdonek | create | | |