From 5f4fbef704d6cd5984d4ce71166425f2a9be7e2e 2012-02-28 20:34:20 From: Paul Date: 2012-02-28 20:34:20 Subject: [PATCH] Fix for #875 Unicode Encoding Error --- diff --git a/IPython/utils/path.py b/IPython/utils/path.py index 555d7dc..36f7f14 100644 --- a/IPython/utils/path.py +++ b/IPython/utils/path.py @@ -106,7 +106,7 @@ def get_py_filename(name, force_win32=None): if os.path.isfile(name): return name else: - raise IOError,'File `%s` not found.' % name + raise IOError,'File `%r` not found.' % name def filefind(filename, path_dirs=None): diff --git a/IPython/utils/tests/test_path.py b/IPython/utils/tests/test_path.py index 1d98b1c..01bd723 100644 --- a/IPython/utils/tests/test_path.py +++ b/IPython/utils/tests/test_path.py @@ -406,3 +406,10 @@ def test_get_py_filename(): else: nt.assert_raises(IOError, path.get_py_filename, '"foo with spaces.py"', force_win32=False) nt.assert_raises(IOError, path.get_py_filename, "'foo with spaces.py'", force_win32=False) + +def test_unicode_in_filename(): + try: + # these calls should not throw unicode encode exceptions + path.get_py_filename(u'fooéè.py', force_win32=False) + except IOError as ex: + str(ex)