On Fri, Sep 11, 2009 at 3:12 PM, Alan G Isaac <alan.is...@gmail.com> wrote: > Michael Foord came up with a much simpler > illustration. With Python 2.6:: > > >>> try: > ... open('flooble') > ... except Exception as e: > ... pass > ... > >>> e > IOError(2, 'No such file or directory') > >>> unicode(e) > u"(2, 'No such file or directory')" > >>> str(e) > "[Errno 2] No such file or directory: 'flooble'" > >>> u'%s' % e > u"(2, 'No such file or directory')" > >>> '%s' % e > "[Errno 2] No such file or directory: 'flooble'"
Sounds like IOError or one of its ancestors defines both __str__() and __unicode__ () special methods but has them produce different output. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list