# HG changeset patch # User Oleg Oshmyan # Date 1339011704 -3600 # Node ID 928a6091454c7fefdb40d45d6da27e303c82a750 # Parent 1b775632cbd91f3a09894dcafa18e3ee4ea77b27# Parent 715e3525a904ec09bb2eff859aa9cd4a18e623c5 Fixed crashing on testconfs inside archives on Python 3 diff -r 1b775632cbd9 -r 928a6091454c 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