From c249c3db98ade701f1f177a9c34afe222129fc29 Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Thu, 31 Dec 2009 11:53:38 +0000 Subject: [PATCH] FIX: UnicodeEncodeError when a path in import dialog has non-ascii characters --- invesalius/gui/dialogs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index 897505b..9ded49c 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -169,8 +169,10 @@ def ShowImportDirDialog(): path = None if dlg.ShowModal() == wx.ID_OK: - path = dlg.GetPath() - + # GetPath returns in unicode, if a path has non-ascii characters a + # UnicodeEncodeError is raised. To avoid this, path is encoded in utf-8 + path = dlg.GetPath().encode('utf-8') + # Only destroy a dialog after you're done with it. dlg.Destroy() os.chdir(current_dir) -- libgit2 0.21.2