From: W. Trevor King Date: Wed, 19 Sep 2012 21:33:13 +0000 (-0400) Subject: Use pygrader.ENCODING when loading ConfigParser files. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=81ba7d2dd85b2133bd83c66a1ecc8034ded449a3;p=pygrader.git Use pygrader.ENCODING when loading ConfigParser files. --- 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']: