Skip to content

Commit 9b50dea

Browse files
committed
conf.py: py2/py3 compatible exception handling
Python 3 requires "except Exception as ex" Python earlier than 2.6 does not understand that syntax. To be compatible with both, get the exception object from sys.exc_info(). Related: rhbz#1328199
1 parent 3a5ea33 commit 9b50dea

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

kobo/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import fnmatch
2727
import itertools
2828
import keyword
29+
import sys
2930
import token
3031
import tokenize
3132
from cStringIO import StringIO
@@ -333,5 +334,6 @@ def _get_tuple(self):
333334
try:
334335
settings = PyConfigParser()
335336
settings.load_from_file(os.environ.get("PROJECT_CONFIG_FILE"))
336-
except Exception, ex:
337+
except Exception:
338+
ex = sys.exc_info()[1]
337339
raise ImproperlyConfigured("Could not load config file: %s" % ex)

0 commit comments

Comments
 (0)