Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.1.5 not compatible with python3.6+ #70

Open
edransjsuarez opened this issue Feb 12, 2019 · 3 comments
Open

Version 2.1.5 not compatible with python3.6+ #70

edransjsuarez opened this issue Feb 12, 2019 · 3 comments
Assignees
Labels

Comments

@edransjsuarez
Copy link

Hi,

Testing the new version 2.1.5::

>test/bin/cfn-cli
Traceback (most recent call last):
  File "test/bin/cfn-cli", line 7, in <module>
    from awscfncli2.__main__ import main
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/__main__.py", line 26, in <module>
    from .cli import cfn_cli
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/cli/__init__.py", line 2, in <module>
    from .main import cfn_cli
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/cli/main.py", line 10, in <module>
    from .context import ClickContext
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/cli/context.py", line 3, in <module>
    from ..runner import Boto3Profile, Boto3RunBook, StackSelector
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/runner/__init__.py", line 1, in <module>
    from .commands.drift_detect_command import DriftDetectOptions, \
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/runner/commands/drift_detect_command.py", line 5, in <module>
    from .command import Command
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/runner/commands/command.py", line 1, in <module>
    from ...cli.utils import StackPrettyPrinter
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/cli/utils/__init__.py", line 2, in <module>
    from .deco import command_exception_handler
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/cli/utils/deco.py", line 7, in <module>
    from ...config import ConfigError
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/config/__init__.py", line 4, in <module>
    from .config import load_config, ConfigError
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/config/config.py", line 7, in <module>
    from .formats import load_format
  File "/home/yyy/test/lib/python3.6/site-packages/awscfncli2/config/formats.py", line 212, in <module>
    class ParamReferenceTemplate(string.Template):
  File "/usr/lib/python3.6/string.py", line 74, in __init__
    cls.pattern = _re.compile(pattern, cls.flags | _re.VERBOSE)
  File "/usr/lib/python3.6/re.py", line 233, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python3.6/re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.6/sre_compile.py", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.6/sre_parse.py", line 855, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.6/sre_parse.py", line 416, in _parse_sub
    not nested and not items))
  File "/usr/lib/python3.6/sre_parse.py", line 765, in _parse
    p = _parse_sub(source, state, sub_verbose, nested + 1)
  File "/usr/lib/python3.6/sre_parse.py", line 416, in _parse_sub
    not nested and not items))
  File "/usr/lib/python3.6/sre_parse.py", line 765, in _parse
    p = _parse_sub(source, state, sub_verbose, nested + 1)
  File "/usr/lib/python3.6/sre_parse.py", line 416, in _parse_sub
    not nested and not items))
  File "/usr/lib/python3.6/sre_parse.py", line 734, in _parse
    flags = _parse_flags(source, state, char)
  File "/usr/lib/python3.6/sre_parse.py", line 803, in _parse_flags
    raise source.error("bad inline flags: cannot turn on global flag", 1)
sre_constants.error: bad inline flags: cannot turn on global flag at position 92 (line 4, column 20)

Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
Python 3.6.7
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Regards,
Jesús A Suárez

@Kotaimen Kotaimen added the bug label Feb 13, 2019
@Kotaimen
Copy link
Owner

Kotaimen commented Feb 13, 2019

Hi @GlieseRay:

Please take a look at this again... and use 3.6, home-brew defaults to 3.7 now.

Update:

Here's what's in py3.6's string.Template:

    # r'[a-z]' matches to non-ASCII letters when used with IGNORECASE,
    # but without ASCII flag.  We can't add re.ASCII to flags because of
    # backward compatibility.  So we use local -i flag and [a-zA-Z] pattern.
    # See https://bugs.python.org/issue31672
    idpattern = r'(?-i:[_a-zA-Z][_a-zA-Z0-9]*)'

So, I'm changing this to:

r'(?-i:[a-zA-Z_][-a-zA-Z0-9_]*\.[a-zA-Z_][-a-zA-Z0-9_]*\.[a-zA-Z_][-a-zA-Z0-9_]*)'

@Kotaimen
Copy link
Owner

Note this fix does not work with 2.7 yet.

@Kotaimen Kotaimen reopened this Feb 17, 2019
@GlieseRay
Copy link
Collaborator

@Kotaimen will change the implementation in next release to accommodate both 2.7 and 3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants