8000 Vendored six raises ImportWarning · Issue #390 · textX/textX · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Vendored six raises ImportWarning #390

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

Closed
davidchall opened this issue Feb 3, 2023 · 5 comments
Closed

Vendored six raises ImportWarning #390

davidchall opened this issue Feb 3, 2023 · 5 comments

Comments

@davidchall
Copy link
Contributor

I've encountered warnings using textX on Python 3.10, which are caused by the vendored version of six. More details of this issue can be found at: secdev/scapy#3502

@igordejanovic
Copy link
Member

Thanks for the report. What did you do to trigger the warning?

@davidchall
Copy link
Contributor Author
davidchall commented Feb 3, 2023

Any project using textx uses the vendored six module when importing other modules. On Python 3.10+, the vendored version of six throws an ImportWarning when it cannot find a module (before it throws the expected ImportError). This means I cannot use try: ... except ImportError: without throwing an ImportWarning.

This problem was fixed in six 1.16.0 (latest version).

import warnings

with warnings.catch_warnings():
    # ensure we notice ImportWarning
    warnings.simplefilter("error", category=ImportWarning)

    # if commented, then vendored six not used and ImportWarning not thrown
    import textx

    try:
        import missing
    except ImportError:
        print("Caught ImportError")

igordejanovic added a commit that referenced this issue Feb 7, 2023
@igordejanovic
Copy link
Member

Thanks for the detailed info. I think now is a good time to remove six as we are not supporting 2.x Python anymore.

@igordejanovic
Copy link
Member

I plan to release textX 3.1 in the following days.

@igordejanovic
Copy link
Member

Version 3.1.0 is released

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

No branches or pull requests

2 participants
0