Uvloop: 'coroutine' object is not iterable

Created on 6 Dec 2017  ·  19Comments  ·  Source: MagicStack/uvloop

  • uvloop version: 0.9.1
  • Python version: 3.6
  • Platform: Ubuntu Xenial

Version 0.9.1:
I got an error

 File "/app/app/<***>/utils.py", line 35, in <***>
    async with app['client_session'].get(url) as response:
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 690, in __aenter__
    self._resp = yield from self._coro
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 267, in _request
    conn = yield from self._connector.connect(req)
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 402, in connect
    proto = yield from self._create_connection(req)
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 748, in _create_connection
    _, proto = yield from self._create_direct_connection(req)
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 831, in _create_direct_connection
    req=req, client_error=client_error)
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 796, in _wrap_create_connection
    return (yield from self._loop.create_connection(*args, **kwargs))
TypeError: 'coroutine' object is not iterable

Version 0.8.1:
Not reproduced

The error does not depend on other libraries.

Most helpful comment

Cython 0.28 and 0.28.1 which includes the required patch is released now. :tada:
Ref: The Cython 0.28.1 changelog
@1st1 I think it is the time to update uvloop! :wink:

All 19 comments

I forgot if I met this problem, but I guess the build script about uvloop
has some problems because I rewrite the Arch pkgbuild about uvloop and
fixed some problems like yours

Alex Kuzmenko notifications@github.com 于 2017年12月6日周三 17:01写道:

>

  • uvloop version: 0.9.1
  • Python version: 3.6
  • Platform: Ubuntu Xenial

Version 0.9.1:
I got an error

File "/app/app/<>/utils.py", line 35, in <>
async with app['client_session'].get(url) as response:
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 690, in __aenter__
self._resp = yield from self._coro
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 267, in _request
conn = yield from self._connector.connect(req)
File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 402, in connect
proto = yield from self._create_connection(req)
File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 748, in _create_connection
_, proto = yield from self._create_direct_connection(req)
File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 831, in _create_direct_connection
req=req, client_error=client_error)
File "/usr/local/lib/python3.6/dist-packages/aiohttp/connector.py", line 796, in _wrap_create_connection
return (yield from self._loop.create_connection(args, *kwargs))
TypeError: 'coroutine' object is not iterable

Version 0.8.1:
Not reproduced

The error does not depend on other libraries.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/MagicStack/uvloop/issues/122, or mute the thread
https://github.com/notifications/unsubscribe-auth/AJoPKUG3ZBQ4l1ck6TYOBd86OcJwziOsks5s9lfigaJpZM4Q3kuJ
.

Did you install uvloop via pip? Do you use any other packages that are compiled with Cython?

yes, we use pip. and we have other packages (compiled with Cython) (for example: aiohttp, cChardet)

I get the same with Python 3.6 (stock cpython, Ubuntu 17.10) with a pip-installed uvloop

Another bump here with Python 3.6 on Ubuntu as well.

Same here. (Python 3.6.4, Ubuntu 17.10)

I facing this problem too, using aiohttp, any workaround? Snippet of my code:

            try:
                async with async_timeout.timeout(15):
                    async with self.session.get('http://example.com') as resp:
                        response = resp
                        break
            except Exception as e:

I suspect that the bug is in Cython. Waiting for its next release to fix things.

Have observed the same problem in our production code.
Surprisingly plain aiohttp example (without our straightforward but complex tooling built on top of aiohttp session) worked fine.

I was unable to pin down the minimal reproducible test case unfortunately.

I'm having the exact same issue on my project, in this case when creating an asyncio_redis connection. It only happens if I import BeautifulSoup at the module level (so it was already imported before calling loop.create_connection()). I'm importing it at the function level as a workaround.

I have this issue too with aiohttp

Again, it looks like this is a regression in Cython. Try installing earlier uvloop versions, we'll fix it with the next Cython release.

A new @cython.iterable_coroutine decorator has been added to Cython, which should resolve this issue. Now waiting for the next release to happen.

I have the same issue using uvloop 0.9.1 in python 3.5.2 with asyncio create_subprocess_exec. I hope this will be fixed soon!

uvloop version: 0.9.1
Python version: 3.6.4
Platform: Mac OS
I got the same issue, hope this to be fixed soon.

Cython 0.28 and 0.28.1 which includes the required patch is released now. :tada:
Ref: The Cython 0.28.1 changelog
@1st1 I think it is the time to update uvloop! :wink:

Fixed in master. Please test :)

I keep having this issue. I am using the latest cpython and uvloop. Any clues how I can fix this? : )

Not sure. Most likely it's unrelated to uvloop. I suggest debugging the line that causes this exception.

Was this page helpful?
0 / 5 - 0 ratings