Skip to content

Error RuntimeError: There is no current event loop in thread 'Thread-3'. #1145

Answered by dlchamp
Xalwer asked this question in Q&A
Discussion options

You must be logged in to vote

While it's not a direct answer to the problem but, why not use something like mafic with lavalink?
It simplifies this entire process and moves most of this into a separate service that handles the youtube (plus other services) stuff and provides your bot a stream that's ready to go also eliminates the use of requests (blocking) to hit Youtube API or dealing with threading and such.

But for your issue:
It's likely because vc.play() creates an AudioPlayer(threading.Thread) (which is also where after is called) in a new thread which does not have an event loop. Threads + asyncio just make it more complicated when there is a very simple solution - see above.

As for a solution:
Maybe something…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Xalwer
Comment options

@dlchamp
Comment options

Answer selected by Xalwer
@Xalwer
Comment options

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