From 1c5b9f289807bf9b00b292502d5103bfdeb65a80 Mon Sep 17 00:00:00 2001 From: Nico Geyso Date: Thu, 12 Feb 2015 20:43:47 +0100 Subject: backend - fix UnicodeDecodeError Fix UnicodeDecodeError when performing os.walk in get_exams(). Default encoding for python is ascii but in linux it's utf-8. --- app/backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/backend.py b/app/backend.py index 0dbebb8..e601c0c 100644 --- a/app/backend.py +++ b/app/backend.py @@ -35,7 +35,7 @@ class Storage: def get_exams(self, name): """ Lists all exams of a given course """ # loop over all directories which do not contain any subdirs - for root, dirs, files in os.walk(self._join(name)): + for root, dirs, files in os.walk(self._join(name).encode('utf-8')): if len(dirs) == 0: # metainformation is encoded in path: course/year/exam.pdf splitted = root.split(os.path.sep) -- cgit v1.2.3-1-g7c22