amikrop/aiomixcloud

SyntaxError: 'async with' outside async function

Closed this issue · 1 comments

I'm trying to get even just the basic example in the README and am getting this error straight away.

I'm new to python, and am using 3.7, so I'm wondering if I need to downgrade to an old version, or if the documentation is out of date.

I get it working (sort of) by wrapper everything in an async function and calling it with asyncio.run(_main()) but that seems like it defeats the purpose of your library.

Hello.
As the example says through a comment, that code needs to be inside a coroutine function.
It does not defeat the purpose of the library, on the contrary this is its exact purpose, asynchronous
functionality.
There is also the capability of synchronous usage if you are interested in that.