Mercurial > ~astiob > upreckon > hgweb
changeset 229:928a6091454c
Fixed crashing on testconfs inside archives on Python 3
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Wed, 06 Jun 2012 20:41:44 +0100 |
parents | 1b775632cbd9 (current diff) 715e3525a904 (diff) |
children | f94f9724c543 |
files | |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/upreckon/config.py Wed Jun 06 20:22:18 2012 +0100 +++ b/upreckon/config.py Wed Jun 06 20:41:44 2012 +0100 @@ -1,4 +1,4 @@ -# Copyright (c) 2010-2011 Chortos-2 <chortos@inbox.lv> +# Copyright (c) 2010-2012 Chortos-2 <chortos@inbox.lv> from __future__ import division, with_statement @@ -129,7 +129,8 @@ with metafile.open() as f: module = imp.load_module('testconf', f, metafile.full_real_path, ('.py', 'r', imp.PY_SOURCE)) # Handle the case when f is not a true file object but imp requires one - except ValueError: + # TypeError on Python 3, ValueError on Python 2 + except (TypeError, ValueError): # FIXME: 2.5 lacks the delete parameter with tempfile.NamedTemporaryFile(delete=False) as f: inputdatafname = f.name @@ -241,7 +242,8 @@ with metafile.open() as f: module = imp.load_module('testconf', f, metafile.full_real_path, ('.py', 'r', imp.PY_SOURCE)) # Handle the case when f is not a true file object but imp requires one - except ValueError: + # TypeError on Python 3, ValueError on Python 2 + except (TypeError, ValueError): # FIXME: 2.5 lacks the delete parameter with tempfile.NamedTemporaryFile(delete=False) as f: inputdatafname = f.name