# HG changeset patch # User Oleg Oshmyan # Date 1339011704 -3600 # Node ID 715e3525a904ec09bb2eff859aa9cd4a18e623c5 # Parent ebb35960b5bc6343008d76581aa0196e58082afe Fixed crashing on testconfs inside archives on Python 3 diff -r ebb35960b5bc -r 715e3525a904 upreckon/config.py --- 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 +# Copyright (c) 2010-2012 Chortos-2 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