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

ImportError: cannot import name 'hdrs' #3285

Closed
sbhadr opened this issue Sep 24, 2018 · 9 comments
Closed

ImportError: cannot import name 'hdrs' #3285

sbhadr opened this issue Sep 24, 2018 · 9 comments

Comments

@sbhadr
Copy link

sbhadr commented Sep 24, 2018

Long story short

Aiohttp is unusable when imported on Python 3.5.

Expected behaviour

Normal usage.

Actual behaviour

ImportError: cannot import name 'hdrs' when importing aiohttp.

Steps to reproduce

import aiohttp

Your environment

Windows 10, Python 3.5

Error Log

Traceback (most recent call last):
  File "cc.py", line 1, in <module>
    from pyblox import *
  File "C:\Users\sanja\AppData\Local\Programs\Python\Python35\lib\site-packages\pyblox\__init__.py", line 16, in <module>
    from .api.assets import Assets
  File "C:\Users\sanja\AppData\Local\Programs\Python\Python35\lib\site-packages\pyblox\api\assets.py", line 9, in <module>
    from .http import Http
  File "C:\Users\sanja\AppData\Local\Programs\Python\Python35\lib\site-packages\pyblox\api\http.py", line 11, in <module>
    import aiohttp
  File "C:\Users\sanja\AppData\Roaming\Python\Python35\site-packages\aiohttp\__init__.py", line 9, in <module>
    from . import hdrs  # noqa
ImportError: cannot import name 'hdrs'
@asvetlov
Copy link
Member

GitMate.io thinks possibly related issues are #849 (Example Server Fails to Run with "ImportError: cannot import name 'InvalidURL'"), #843 (ImportError: No module named 'aiohttp'), #2662 (ImportError: cannot import name 'unquote'), #1447 (ImportError: cannot import name 'quote'), and #936 (ImportError: No modile named 'http.server' when I try to run pytests).

@asvetlov asvetlov added the bug label Sep 24, 2018
@asvetlov
Copy link
Member

The minimal supported version is Python 3.5.3
If you have it at least -- aiohttp works, we run tests for Python 3.5 on Windows box explicitly

@sbhadr
Copy link
Author

sbhadr commented Sep 24, 2018

Import Error on call is not exactly my conception of "working". Any reason as to why Python 3.5.3 is supported but not Python 3.5 ?

@asvetlov
Copy link
Member

aiohttp relies on features introduced in Python 3.5.3
Do you use older Python?

@sbhadr
Copy link
Author

sbhadr commented Sep 25, 2018

Yes, Python 3.5. Could you be specific as to which features introduced in Python 3.5.3 ?

@asvetlov
Copy link
Member

Python 3.5.X
What is X on your box?
If your pip version is not too old the tool cannot install aiohttp 3.x on not compatible Python, e.g. 3.5.2

@sbhadr
Copy link
Author

sbhadr commented Sep 26, 2018

Python 3.5.X What is X on your box?
Python 3.5.0

If your pip version is not too old the tool cannot install aiohttp 3.x on not compatible Python, e.g. 3.5.2
Pip is up to date.

Could you be specific as to which features introduced in Python 3.5.3 ?

@asvetlov
Copy link
Member

Up-to-date pip means pip --version is something like 18.0.
It respects python-requires argument from metadata: https://github.com/aio-libs/aiohttp/blob/master/setup.py#L148

There are many changes: transport.set_protocol() and __aiter__ signature for example.
The most notable change is: asyncio.get_event_loop() is reliable.
If called from async function the returned value is an active (running) loop, not the loop specified by asyncio.set_event_loop() call.

@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.
Projects
None yet
Development

No branches or pull requests

2 participants