ipython/ipython — Issue #875: never build unicode error messages
Author: minrk
Created: 2011-10-14 19:37:58+00:00
State: open

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:
%pfile døesnøtexist

Or the output of any time we such an error might be raised, e.g:

```python
In [8]: raise IOError("file %s does not exist" % u'é')
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
/Users/minrk/dev/ip/mine/ in ()
----> 1 raise IOError("file %s does not exist" % u'é')

: (, UnicodeEncodeError('ascii', u'file \xe9 does not exist', 5, 6, 'ordinal not in range(128)'))
```