From c6dfae7d246ab39dab54889c7127b98b5e3e66fb 2015-10-09 12:10:35 From: John Kirkham Date: 2015-10-09 12:10:35 Subject: [PATCH] IPython/utils/path.py: Try to use the system encoding, if provided. Otherwise, fallback to `utf8`. --- diff --git a/IPython/utils/path.py b/IPython/utils/path.py index 69ab3d9..a5e6db2 100644 --- a/IPython/utils/path.py +++ b/IPython/utils/path.py @@ -441,7 +441,7 @@ def ensure_dir_exists(path, mode=0o755): try: path_exists = os.path.exists(path) except UnicodeEncodeError: - path = path.encode("utf8") + path = path.encode(sys.getfilesystemencoding() or "utf8") path_exists = os.path.exists(path) if not os.path.exists(path):