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'"

Cheers,
Alan Isaac

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to