Commit c249c3db98ade701f1f177a9c34afe222129fc29

Authored by tfmoraes
1 parent caac4beb

FIX: UnicodeEncodeError when a path in import dialog has non-ascii characters

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
invesalius/gui/dialogs.py
... ... @@ -169,8 +169,10 @@ def ShowImportDirDialog():
169 169  
170 170 path = None
171 171 if dlg.ShowModal() == wx.ID_OK:
172   - path = dlg.GetPath()
173   -
  172 + # GetPath returns in unicode, if a path has non-ascii characters a
  173 + # UnicodeEncodeError is raised. To avoid this, path is encoded in utf-8
  174 + path = dlg.GetPath().encode('utf-8')
  175 +
174 176 # Only destroy a dialog after you're done with it.
175 177 dlg.Destroy()
176 178 os.chdir(current_dir)
... ...