we must never create exceptions with unicode error messages, because then str(exc)
, print exc
, and "%s" % exc
will raise UnicodeEncodeErrors.
An example of one of these is path.get_py_filename, which creates an IOError with %s
on a path that can be unicode. When in doubt, use %r
when building exception messages.
See:
Or the output of any time we such an error might be raised, e.g:
In [8]: raise IOError("file %s does not exist" % u'é') --------------------------------------------------------------------------- IOError Traceback (most recent call last) /Users/minrk/dev/ip/mine/<ipython-input-8-1e82695b5095> in <module>() ----> 1 raise IOError("file %s does not exist" % u'é') <type 'str'>: (<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u'file \xe9 does not exist', 5, 6, 'ordinal not in range(128)'))
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4