Catch exception when trying to open config file

This commit is contained in:
Andrew Resch 2009-05-30 01:32:25 +00:00
parent 019c78db47
commit 30efe143fe
1 changed files with 7 additions and 1 deletions

View File

@ -281,7 +281,13 @@ class Config(object):
""" """
if not filename: if not filename:
filename = self.__config_file filename = self.__config_file
data = open(filename, "rb")
try:
data = open(filename, "rb")
except IOError, e:
log.warning("Unable to open config file %s: %s", filename, e)
return
try: try:
self.__format_version = int(data.readline()) self.__format_version = int(data.readline())
except ValueError: except ValueError: