From 81ba7d2dd85b2133bd83c66a1ecc8034ded449a3 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 19 Sep 2012 17:33:13 -0400 Subject: [PATCH] Use pygrader.ENCODING when loading ConfigParser files. --- bin/pg.py | 5 ++++- pygrader/storage.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/pg.py b/bin/pg.py index dd8215e..fd7586c 100755 --- a/bin/pg.py +++ b/bin/pg.py @@ -31,6 +31,7 @@ import sys as _sys import pgp_mime as _pgp_mime from pygrader import __version__ +from pygrader import ENCODING as _ENCODING from pygrader import LOG as _LOG from pygrader import color as _color from pygrader.email import test_smtp as _test_smtp @@ -180,10 +181,12 @@ if __name__ == '__main__': _pgp_mime.LOG.addHandler(syslog) _color.USE_COLOR = args.color + _ENCODING = args.encoding + config = _configparser.ConfigParser() config.read([ _os_path.expanduser(_os_path.join('~', '.config', 'smtplib.conf')), - ]) + ], encoding=_ENCODING) func_args = _inspect.getargspec(args.func).args kwargs = {} diff --git a/pygrader/storage.py b/pygrader/storage.py index d5e2e38..892f18e 100644 --- a/pygrader/storage.py +++ b/pygrader/storage.py @@ -58,7 +58,7 @@ def load_course(basedir): """ _LOG.debug('loading course from {}'.format(basedir)) config = _configparser.ConfigParser() - config.read([_os_path.join(basedir, 'course.conf')]) + config.read([_os_path.join(basedir, 'course.conf')], encoding=_ENCODING) name = config.get('course', 'name') names = {'robot': [config.get('course', 'robot').strip()]} for option in ['assignments', 'professors', 'assistants', 'students']: -- 2.26.2