We're slowly moving to the place where modules are usable on python3 as
well as python2. This is not likely to be reliably usable by 2.2 but you'll
start to see a few modules that you can use on py3 when we release.

As a first step we're starting to get modules to syntax compile with
python3 as well as python2.  There's a blacklist in the testing so we
should only be attempting to compile modules which were compiLing in the
past (so we don't regress).

For exceptions, there's two possibilities for porting  the code:

* if the module can't run on python2.4 (because one of its library
dependencies requires python2.6 and above) then go ahead and switch to
catching the exception via "except ClientError as e:"  The module should
already document that it requires python2.6 sand above in its requirements
action.

* otherwise the module will need to use some helper code to retrieve the
exception in a way compatible with python2.4 and python3:

from ansible.module_utils.pycompat24 import get_exception
[...]
try:
    raise ClientError(msg)
except ClientError:
    e = get_exception()

- toshio
On May 22, 2016 8:39 PM, "Rob White" <robwhit...@gmail.com> wrote:

> Does any one know why Travis has started to fail builds by trying to
> compile with python3?
>
> Example:
>
>
> 0.66s$ python3.4 -m compileall -fq . -x $(echo "$PY3_EXCLUDE_LIST"| tr ' ' 
> '|')
>
> *** Error compiling './cloud/amazon/iam_mfa_device_facts.py'...
>
>   File "./cloud/amazon/iam_mfa_device_facts.py", line 85
>
>     except ClientError, e:
>
>                       ^
>
> SyntaxError: invalid syntax
>
>
> Last i heard, Ansible was supposed to be 2.4 compatible so rewriting the
> above as `except ClientError as e:` would be incorrect.
>
> What gives?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to