qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] tracetool: use Python 2.5-compatible exception


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] tracetool: use Python 2.5-compatible exception handling syntax
Date: Wed, 25 Apr 2012 15:35:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120328 Thunderbird/11.0.1

Am 25.04.2012 11:42, schrieb Stefan Hajnoczi:
> The newer "except <exception-type> as <exception>:" syntax is not
> supported by Python 2.5, we need to use "except <exception-type>,
> <exception>:".
> 
> Tested all trace backends with Python 2.5.6.
> 
> Reported-by: Andreas Färber <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>

Lightly

Tested-by: Andreas Färber <address@hidden>

Works with:
2.5.1 (Mac OS X v10.5.8),
2.6.1 (Mac OS X v10.6.8) and
2.6.4 (OpenIndiana oi_151a).

Thanks a lot!

However, it still breaks with different errors on Python 2.3.3 and 2.4.6
(Solaris 10 U9).

$ python scripts/tracetool.py --list-backends
Traceback (most recent call last):
  File "scritps/tracetool.py", line 19, in ?
    from tracetool import error_writem out
  File "/export/home/andreas/QEMU/qemu/scripts/tracetool/__init__.py",
line 55
    @staticmethod
    ^

$ python2.4 scripts/tracetool.py --list-backends
Traceback (most recent call last):
  File "scripts/tracetool.py", line 138, in ?
    main(sys.argv)
  File "scripts/tracetool.py", line 93, in main
    backends = tracetool.backend.get_list()
  File
"/export/home/andreas/QEMU/qemu/scripts/tracetool/backend/__init__.py",
line 48, in get_list
    for _, modname, _ in pkgutil.iter_modules(tracetool.backend.__path__):
AttributeError: 'module' object has no attribute 'iter_modules'

Seems like Python is not the ultimate better-than-POSIX compatibility
solution after all... :-/

Andreas

> ---
>  scripts/tracetool.py |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/tracetool.py b/scripts/tracetool.py
> index cacfd99..c003cf6 100755
> --- a/scripts/tracetool.py
> +++ b/scripts/tracetool.py
> @@ -70,7 +70,7 @@ def main(args):
>  
>      try:
>          opts, args = getopt.getopt(args[1:], "", long_opts)
> -    except getopt.GetoptError as err:
> +    except getopt.GetoptError, err:
>          error_opt(str(err))
>  
>      check_backend = False
> @@ -131,7 +131,7 @@ def main(args):
>      try:
>          tracetool.generate(sys.stdin, arg_format, arg_backend,
>                             binary = binary, probe_prefix = probe_prefix)
> -    except tracetool.TracetoolError as e:
> +    except tracetool.TracetoolError, e:
>          error_opt(str(e))
>  
>  if __name__ == "__main__":




reply via email to

[Prev in Thread] Current Thread [Next in Thread]