From 133787cf231f1017e777fba0a19c8787f2720c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 23 Dec 2019 12:26:49 -0500 Subject: [PATCH] Fix for #709. --- libs/scandir.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/scandir.py b/libs/scandir.py index 403f52d7b..2177e7487 100644 --- a/libs/scandir.py +++ b/libs/scandir.py @@ -462,6 +462,15 @@ elif sys.platform.startswith(('linux', 'darwin', 'sunos5')) or 'bsd' in sys.plat @property def path(self): if self._path is None: + # Make sure both attributes are string + try: + self._scandir_path = self._scandir_path.decode(encoding="utf-8") + except (UnicodeDecodeError, AttributeError): + pass + try: + self.name = self.name.decode(encoding="utf-8") + except (UnicodeDecodeError, AttributeError): + pass self._path = join(self._scandir_path, self.name) return self._path