From 738e4fa08a85483c678a3c8f2affda6e4f74d09e Mon Sep 17 00:00:00 2001 From: Miguel Barao Date: Fri, 11 Mar 2016 12:44:38 +0000 Subject: [PATCH] - explicit utf-8 encoding opening questions files --- questions.py | 2 +- test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/questions.py b/questions.py index 3c80f40..b8c72df 100644 --- a/questions.py +++ b/questions.py @@ -56,7 +56,7 @@ class QuestionsPool(dict): def add_from_files(self, files, path='.'): for filename in files: try: - with open(os.path.normpath(os.path.join(path, filename)), 'r') as f: + with open(os.path.normpath(os.path.join(path, filename)), 'r', encoding='utf-8') as f: questions = yaml.load(f) except(FileNotFoundError): print('[ ERROR ] Questions file "{0}" not found.'.format(filename)) diff --git a/test.py b/test.py index 6a3c31d..e067838 100644 --- a/test.py +++ b/test.py @@ -47,7 +47,7 @@ def read_configuration(filename, debug=False, show_points=False, show_hints=Fals # where to put the students answers (optional) if 'answers_dir' not in test: - print('[ WARNG ] Missing "answers_dir" in the test configuration file "{0}".\n Tests are NOT being saved. Grades are still being inserted into the database.'.format(filename)) + print('[ WARNG ] Missing "answers_dir" in the test configuration file "{0}".\n Tests are NOT being saved. Grades are still going into the database.'.format(filename)) test['save_answers'] = False else: test['answers_dir'] = os.path.normpath(os.path.expanduser(str(test['answers_dir']))) -- libgit2 0.21.2