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

get this error about asyncio which is applicable to python 3.7 but code covers python versions as shown #12331

Closed
mark-nick-o opened this issue Mar 10, 2022 · 1 comment
Labels
bug mypy got something wrong

Comments

@mark-nick-o
Copy link

my code is below :-

import sys

if (sys.version_info.major == 3 and sys.version_info.minor >= 7):
    asyncio.run(main())
elif (sys.version_info.major == 3 and sys.version_info.minor <= 6) and (sys.version_info.major == 3 and sys.version_info.minor >= 5):
    loop = asyncio.get_event_loop()
    loop.run_until_complete(asyncio.wait(main()))
else:
    print("you currently need to have python 3.5 at least")

runs fine but when checked with mypy i get
8008: error: Module has no attribute "run"
which i guess is for python < 3.7

im running this command line
mypy --ignore-missing-imports <myfile.py>

im using Python 3.8.3 on this machine
in WSL
Linux DESKTOP-M4HNI3V 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux

@mark-nick-o mark-nick-o added the bug mypy got something wrong label Mar 10, 2022
@JelleZijlstra
Copy link
Member

You need to use a slightly different form of version checks. See https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks.

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

No branches or pull requests

2 participants