incompatible with uvloop because of access to private attribute _protocol
See original GitHub issueI’m using uvloop because of the significant speed up that it provides. However this seems to be incompatible with using the starttls method.
minimal example (put in actual connection information before running):
import asyncio
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
import aiosmtplib
async def connect(loop):
smtp = aiosmtplib.SMTP(
loop=loop,
hostname=localhost,
port=port,
use_tls=True)
await smtp.connect(use_tls=False, port=port)
await smtp.starttls(validate_certs=False)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(connect(loop))
result
Traceback (most recent call last):
File "minimal_example.py", line 19, in <module>
loop.run_until_complete(connect(loop))
File "uvloop/loop.pyx", line 1203, in uvloop.loop.Loop.run_until_complete (uvloop/loop.c:25632)
File "minimal_example.py", line 15, in connect
await smtp.starttls(validate_certs=False)
File "/git/dnd/lib64/python3.6/site-packages/aiosmtplib/esmtp.py", line 193, in starttls
tls_context, server_hostname=server_hostname, timeout=timeout)
File "/git/dnd/lib64/python3.6/site-packages/aiosmtplib/protocol.py", line 209, in starttls
tls_context, server_hostname=server_hostname, waiter=waiter)
File "/git/dnd/lib64/python3.6/site-packages/aiosmtplib/protocol.py", line 82, in upgrade_transport
self.reader._transport._protocol = tls_protocol # type: ignore
AttributeError: 'uvloop.loop.TCPTransport' object has no attribute '_protocol'
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
incompatible with uvloop because of access to ... - GitHub
I'm using uvloop because of the significant speed up that it provides. However this seems to be incompatible with using the starttls method....
Read more >python-websockets(1) - Arch manual pages
The WebSocket protocol provides two-way communication between a browser and a server over a persistent connection. That's exactly what you need to exchange ......
Read more >'uvloop' has no attribute 'EventLoopPolicy' - Stack Overflow
It's pesky because (at least on CentOS) some pip-installed Python packages go in /usr/local/lib/python3.7/site-packages and some go in /usr/ ...
Read more >Release 4.10 David Cortesi - PyInstaller Documentation
If your program depends on access to certain data files, ... Note: PyInstaller currently does not preserve file attributes. see #3926.
Read more >v3.7.3 PDF - aiohttp Documentation
Because the content attribute is a StreamReader (provides async iterator protocol), you can chain get and post requests together:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hmmm, uvloop seems to handle protocols and transports a bit differently internally.
Unfortunately there is no public API to upgrade an asyncio connection in place yet, so it’s understandable that uvloop behaves differently. I’ll see if I can find a way to get it working.
Thanks!