提交 9a8552eb 编写于 作者: A Alessio Sergi

UTF-8 config file for python 3 [issue #295]

上级 6c5b640e
......@@ -387,7 +387,15 @@ class Config:
"""
for path in self.get_paths_list():
if os.path.isfile(path) and os.path.getsize(path) > 0:
self.parser.read(path)
try:
if sys.version_info >= (3, 2):
self.parser.read(path, encoding='utf-8')
else:
self.parser.read(path)
except UnicodeDecodeError as e:
print(_("Error decoding config file '%s': %s") % (path, e))
sys.exit(1)
break
def get_paths_list(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册