Uvloop: TCPTransport object has no attribute _protocol

Created on 23 Jul 2016  路  5Comments  路  Source: MagicStack/uvloop

  • uvloop version: 0.5.0
  • python version: 3.5.2
  • platform: os x 10.11.6

Tried running aiopyramid websocket example, it raises AttributeError: 'uvloop.loop.TCPTransport' object has no attribute '_protocol'.

With asyncio event loop it's working fine.

aiopyramid is using internal API, but is there any way of providing similar _protocol property in uvloop?

enhancement

Most helpful comment

Please no.
Keep private API really private.

All 5 comments

Please no.
Keep private API really private.

I can't find aiopyramid websocket example.
The exception happened here?
https://github.com/housleyjk/aiopyramid/blob/8aef5f4f8c823d138f36b68df2ad40a8b5adb6a3/aiopyramid/websocket/config/gunicorn.py#L118-L128

I think this issue should be go asyncio ML, "What is the standard way to switch protocol of transport?"

I think this issue should be go asyncio ML, "What is the standard way to switch protocol of transport?"

Right. Exposing the property would be an easy thing to do in uvloop, but we should (or shouldn't?) have an API for switching protocols.

The exception happens exactly here https://github.com/housleyjk/aiopyramid/blob/8aef5f4f8c823d138f36b68df2ad40a8b5adb6a3/aiopyramid/websocket/config/gunicorn.py#L126.

The aio websocket example can be created like that:

pip install aiopyramid gunicorn
pcreate -s aio_websocket <project>
cd <project>
python setup.py develop
pserve development.ini # or gunicorn --paste development.ini

I agree that there should be a better way in asyncio transport to switch protocol other than accessing private variable, but for now we don't have it. I've proposed it on python/asyncio issue tracker (https://github.com/python/asyncio/issues/388)

Having a private property similar as asyncio standard loop is a good thing, just to make uvloop a drop-in replacement for asyncio standard loop even in edge cases like aiopyramid's one.

set_protocol and get_protocol were added couple of releases ago. Closing this issue now.

Was this page helpful?
0 / 5 - 0 ratings