-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
AttributeError: 'NoneType' object has no attribute 'accept' #1382
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
Comments
What's in colorama/win32.py at line 97? By asking mypy to analyze a large
new codebase you've probably triggered some random mypy bug.
You might turn of --use-python-path; it's usually better to ignore 3rd
party modules for which no stubs exist than trying to analyze the whole
library.
Maybe --silent-imports would be helpful instead.
|
colorama/win32.py:97: def winapi_test():
handle = handles[STDOUT]
csbi = CONSOLE_SCREEN_BUFFER_INFO()
success = _GetConsoleScreenBufferInfo(
handle, byref(csbi))
return bool(success) Nothing that seems too out of the ordinary unless the implicit None return is causing the uses to error out (is that a reasonable hypothesis)? The reason I added
Perhaps I simply have a misunderstanding of the use of MYPYPATH? With An ancillary question to this (I can move this line of discussion elsewhere if that's better), when I import a type from a library (e.g. asyncio), isn't it resolvable by mypy the same way python would resolve? If so, one would expect that those types would be available for use but not necessarily type checked. If that's not the case then I'll have to review the documentation. |
It could, but usually this isn't what you want, because the asyncio library isn't marked up with type annotations (yet). Instead, mypy defaults to using stubs (https://www.python.org/dev/peps/pep-0484/#stub-files) that it gets from a repo named typeshed (https://github.com/python/typeshed/). The reason you get an error on BaseEventLoop is that the stubs for asyncio are incomplete. You can shut this up temporarily by adding Regarding the colorama library, ideally we should get stubs for that too. Even once we fix the crash, mypy wouldn't get that much information out of parsing the unannotated colorama files. I don't know what's wrong with that code either; most likely something else in the file (or even in something it imports) is the true cause. For posterity I'll link to that line in the colorama repo: https://github.com/tartley/colorama/blob/master/colorama/win32.py#L97 |
Pretty sure this is a dupe of #1289. |
More than happy to. Should I just start looking through typeshed and ensuring that aiohttp has proper entries? |
Go for it.
|
This is possibly due to missing or outdated pyi files for colorama but reporting here to make sure it doesn't get lost. The trace is included below.
This was the result of running on a largish code base with
--use-python-path
where colorama is included as an indirect dependency.Any pointers as to how to begin troubleshooting would be appreciated; I'm going to begin by investigating the typeshed for colorama.
The text was updated successfully, but these errors were encountered: