Skip to content

How to make bleak compatibile with cmd, cmd2, or other terminal apps? #1513

Answered by dpkristensen
dpkristensen asked this question in Q&A
Discussion options

You must be logged in to vote

It's frustrating that there's no built-in functionality to the asyncio library that does this, as it seems this is a too-common problem with a not-so-common solution.

I had searched for cmd and cmd2 in the discussion here with no results so maybe this will at least improve the visibility of this solution. Not sure if there are any libraries out there that provide this functionality, but maybe someone will make one. It might have been nice if bleak did not rely on asyncio in the public interface, but it's too late to change it. Maybe for bleak2! 😄

I got this working by creating a singleton object that encapsulates a thread and the asyncio loop execution. Anyone may feel free to use this or…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dpkristensen
Comment options

Answer selected by dpkristensen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants