Aiohttp: ImportError: cannot import name 'quote'

Created on 3 Dec 2016  路  14Comments  路  Source: aio-libs/aiohttp

Long story short

After last yarl update we can not use aiohttp (1.1.5) with it.
https://travis-ci.org/home-assistant/home-assistant/jobs/180947922

outdated

Most helpful comment

As of today latest versions of aiohttp==2.3.7 and yarl==1.0.0 this problem raises again.

Less than a month updates:
aiohttp 2.3.7 (2017-12-27)
yarl 1.0.0 (2018-01-15)

Yarl changelogs:
1.0.0 (2018-01-15)
Drop yarl.quote and yarl.unquote public functions.
0.8.1 (2016-12-03)
Fix broken aiohttp: revert back quote / unquote.
0.8.0 (2016-12-03)
Don't expose yarl.quote and yarl.unquote, these functions are part of private API.

What kind o management is this? If they are private then they are, stop exposing and avoid other projects rely on them, otherwise do not drop them later.

All 14 comments

From the Yarl 0.8 changes:

Don't expose yarl.quote and yarl.unquote, these functions are part of private API

quote and unquote are used in aiohttp, example. And aiohttp depends on a greater than version of Yarl, meaning it will try now to install 0.8 which breaks builds.

This has broken all of aiohttp tests too https://github.com/KeepSafe/aiohttp/pull/1446

Same thing with aiohttp_admin :smile: (https://travis-ci.org/aio-libs/aiohttp_admin/jobs/180946355)

Looks like aiohttp can use urllib.parse import quote, unquote instead of yarl one.

For people that are looking to fix their own builds while waiting for aiohttp to be updated, pinning Yarl to 0.7.1 (the last release in the 0.7.x series) will do the trick. Example

Guys, I'm very sorry.
Should be fixed by 0.8.1 (build is running now)

Thanks for the quick response @asvetlov

Sorry, it was my epic fault.
Shame on me.
Thank you all guys very much for very quick bug report.

As of today latest versions of aiohttp==2.3.7 and yarl==1.0.0 this problem raises again.

Less than a month updates:
aiohttp 2.3.7 (2017-12-27)
yarl 1.0.0 (2018-01-15)

Yarl changelogs:
1.0.0 (2018-01-15)
Drop yarl.quote and yarl.unquote public functions.
0.8.1 (2016-12-03)
Fix broken aiohttp: revert back quote / unquote.
0.8.0 (2016-12-03)
Don't expose yarl.quote and yarl.unquote, these functions are part of private API.

What kind o management is this? If they are private then they are, stop exposing and avoid other projects rely on them, otherwise do not drop them later.

Long traceback short..
``` File "/home/csaba/Downloads/Lola/slackbot/lib/python3.6/site-packages/aiohttp/web_urldispatcher.py", line 21, in
from yarl import URL, unquote
ImportError: cannot import name 'unquote'

Yeah, still happening for me too, even though I'm using the latest aiohttp version (as of today).

same problem

Same problem here.

Would be great to either pin the yarl dependency or have integration tests between this two libs so we assure this issue doesn't happen again.

Just a yarl<1 would be enough. You don't wanna really pin the dep in aiohttp, but rather keep loose with just enough protection against version incompatibility, since aiohttp is a library and not an end project.

done

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].

Was this page helpful?
0 / 5 - 0 ratings