From 7fe954f943d52292938421aa3c77789b2c64a4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Tu=C4=8Dek?= Date: Wed, 6 Jun 2018 17:38:29 +0200 Subject: [PATCH] properly handle unicode characters in home dirs --- notebook/notebookapp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index e1db9d879ef..c2066e40af0 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -213,6 +213,8 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager, root_dir = contents_manager.root_dir home = os.path.expanduser('~') + if sys.version_info.major == 2: + home = home.decode(sys.getfilesystemencoding()) if root_dir.startswith(home + os.path.sep): # collapse $HOME to ~ root_dir = '~' + root_dir[len(home):]