From 91975fd261412398ce0cc73561577e96b7378bd2 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 15 Dec 2012 21:51:14 +0100 Subject: Fix a TB on python < 3.2 --- src/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/config.py b/src/config.py index 0f375c88..abb39011 100644 --- a/src/config.py +++ b/src/config.py @@ -17,6 +17,7 @@ from os import environ, makedirs, path from shutil import copy2 from args import parse_args + class Config(RawConfigParser): """ load/save the config to a file @@ -24,7 +25,10 @@ class Config(RawConfigParser): def __init__(self, file_name): self.file_name = file_name RawConfigParser.__init__(self, None) - RawConfigParser.read(self, file_name, encoding='utf-8') + try: + RawConfigParser.read(self, file_name, encoding='utf-8') + except TypeError: # python < 3.2 sucks + RawConfigParser.read(self, file_name) # Check config integrity and fix it if it’s wrong for section in ('bindings', 'var'): if not self.has_section(section): -- cgit v1.2.3