aio-libs / aio-libs/aiomysql

aiomysql does not support TLS on Python 3.8 on Windows

Open
#589 0 comments 1 reaction 0 assignees View on GitHub
bug docs
Dominant language
Python
Stars
1.9k
Forks
272
PR merge metrics
No merged PRs in 30d

Description

Due to the Python 3.8 changing the default event loop to proactor, `start_tls` does not work, therefore you cannot connect to a server using TLS.

As per https://github.com/tornadoweb/tornado/issues/2608 and https://github.com/aio-libs/aiohttp/issues/4536, this limitation should probably be documented somewhere.

The solution, change the event loop policy before the event loop is created.
```py
async def main():
# Do stuff
pass

if __name__ == "__main__":
policy = asyncio.WindowsSelectorEventLoopPolicy()
asyncio.set_event_loop_policy(policy)
asyncio.run(main())
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.