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

AttributeError: 'NoneType' object has no attribute 'errno' #2231

Closed
steven2308 opened this issue Aug 29, 2017 · 1 comment
Closed

AttributeError: 'NoneType' object has no attribute 'errno' #2231

steven2308 opened this issue Aug 29, 2017 · 1 comment
Labels

Comments

@steven2308
Copy link

steven2308 commented Aug 29, 2017

Long story short

Trying to resolve a domain which is an alias for another one, which does not have an A or CNAME record, raises AttributeError: 'NoneType' object has no attribute 'errno'

Expected behaviour

Raise an error correctly, socket.gaierror probably.

Actual behaviour

  File "xtest.py", line 16, in <module>
    process()
  File "/usr/lib/python3.6/asyncio/base_events.py", line 449, in run_until_complete
    return future.result()
  File "/usr/lib/python3.6/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/myenv/lib/python3.6/site-packages/aiohttp/helpers.py", line 72, in send
    return self._coro.send(arg)
  File "/myenv/lib/python3.6/site-packages/aiohttp/client.py", line 233, in _request
    conn = yield from self._connector.connect(req)
  File "/myenv/lib/python3.6/site-packages/aiohttp/connector.py", line 378, in connect
    proto = yield from self._create_connection(req)
  File "/myenv/lib/python3.6/site-packages/aiohttp/connector.py", line 687, in _create_connection
    _, proto = yield from self._create_direct_connection(req)
  File "/myenv/lib/python3.6/site-packages/aiohttp/connector.py", line 735, in _create_direct_connection
    exc.errno,
AttributeError: 'NoneType' object has no attribute 'errno'

Steps to reproduce

This script will reproduce the error.

import asyncio
import aiohttp
from aiohttp.resolver import AsyncResolver

def process():
    url = 'http://esly.win/'
    resolver = AsyncResolver()
    conn = aiohttp.TCPConnector(resolver=resolver, verify_ssl=False)
    session = aiohttp.ClientSession(connector=conn)
    return session.get(url)

loop = asyncio.get_event_loop()
loop.run_until_complete(
    process()
)

If I use the session without setting the connector it first raises a socket.gaierror but then

During handling of the above exception, another exception occurred...

And the same traceback appears.

Your environment

Python 3.6.0b2
Ubuntu 10.10
aiohttp==2.2,5
Also happens with aiohttp==2.3.0a0 (installed from git on 29/Aug/2017)

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant