-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no current event loop in thread 'ScriptRunner.scriptThread' Error #101
Comments
What command are you running that results in this error? Normally, when you run But in general, you should be able to use |
I work on the script: (it is recomended by fetchai in the link https://docs.fetch.ai/uAgents/simple-interaction/#add-a-second-agent) lets say it agents.py. in the terminal, when I run python agents.py it works well. My problem is the usage of this code in a Python framework (web frameworks). In any framework, when a state change is a must, I get the error "get_event_loop raise RuntimeError('There is no current event loop in thread %r.' RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'". So I thouhgt that ı need to call asyncio.get_event_loop(). I try to visulate ctx.logger.info in a print method (not a console (window) log or any console print (terminal) method). when i tried to use your script by modifing the framework, it gave the error above. from uagents import Agent, Context, Bureau alice = Agent(name="alice", seed="alice recovery phrase") @alice.on_interval(period=2.0) @bob.on_interval(period=2.0) bureau = Bureau() if name == "main": |
Thanks for the extra info! It's not clear to me which web framework you are using, but for some web frameworks it helps to install import nest_asyncio
nest_asyncio.apply() So that might be worth a try. If that doesn't work, can you say which particular web framework you are using? |
I am working on streamlit dapp, it has own asyncio function inside, so uagents module and streamlit are incompatible sadly. your recommendation did not solve the problem. |
@selcuktopal80 I'm working on a project very similar to yours, did you fixed the problem? If so, how? |
Please follow up the discussion in #124 and see if the already existing solution helps or if we'll need to prioritise the latter where an agent can attach to an already running loop. |
Moved from here: fetchai/cosmpy#360
The text was updated successfully, but these errors were encountered: