Commit 738e4fa08a85483c678a3c8f2affda6e4f74d09e
1 parent
6cbdd81d
Exists in
master
and in
1 other branch
- explicit utf-8 encoding opening questions files
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
questions.py
@@ -56,7 +56,7 @@ class QuestionsPool(dict): | @@ -56,7 +56,7 @@ class QuestionsPool(dict): | ||
56 | def add_from_files(self, files, path='.'): | 56 | def add_from_files(self, files, path='.'): |
57 | for filename in files: | 57 | for filename in files: |
58 | try: | 58 | try: |
59 | - with open(os.path.normpath(os.path.join(path, filename)), 'r') as f: | 59 | + with open(os.path.normpath(os.path.join(path, filename)), 'r', encoding='utf-8') as f: |
60 | questions = yaml.load(f) | 60 | questions = yaml.load(f) |
61 | except(FileNotFoundError): | 61 | except(FileNotFoundError): |
62 | print('[ ERROR ] Questions file "{0}" not found.'.format(filename)) | 62 | print('[ ERROR ] Questions file "{0}" not found.'.format(filename)) |
test.py
@@ -47,7 +47,7 @@ def read_configuration(filename, debug=False, show_points=False, show_hints=Fals | @@ -47,7 +47,7 @@ def read_configuration(filename, debug=False, show_points=False, show_hints=Fals | ||
47 | 47 | ||
48 | # where to put the students answers (optional) | 48 | # where to put the students answers (optional) |
49 | if 'answers_dir' not in test: | 49 | if 'answers_dir' not in test: |
50 | - 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)) | 50 | + 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)) |
51 | test['save_answers'] = False | 51 | test['save_answers'] = False |
52 | else: | 52 | else: |
53 | test['answers_dir'] = os.path.normpath(os.path.expanduser(str(test['answers_dir']))) | 53 | test['answers_dir'] = os.path.normpath(os.path.expanduser(str(test['answers_dir']))) |