Spike Posted February 27, 2020 Share Posted February 27, 2020 Hi, i'm using an api whitch uses async and awake calls (i'm not that familiar with threading) - the problem is that these calls are stopping/blocking my whole houdini interface from working I'm connecting houdini with discord by import discord token = "xxxxxxxxxx" client = discord.Client() @client.event async def on_message(message): print(message.content) messages = await channel.history(limit=123).flatten() if message.content.find("hello") != -1: await message.channel.send("hi back") client.run(token) but this blocks my whole houdini application - the python script is running smoothly in the background (and works) Hope you can help me! - really desperate at the moment that this is not working if it i helps: discord api is using asyncio to work with threads Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted February 28, 2020 Share Posted February 28, 2020 (edited) I assume you're using Python 3 build of Houdini-18? Not only it's not official yet but it's far from stable first of all. Second, if you look at the Discord API docs, it says that client.run() is blocking, meaning it's spawning an event loop that blocks the interpreter which runs on the main thread where the Houdini UI runs too. You need to run your Discord client code on a separate thread. It's a big topic and far beyond the scope of Houdini. From a random google page: from threading import Thread import asyncio def start_loop(loop): asyncio.set_event_loop(loop) loop.run_forever() new_loop = asyncio.new_event_loop() t = Thread(target=start_loop, args=(new_loop,)) t.start() Edited February 28, 2020 by Stalkerx777 typo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.