Skip to content
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

Await never resolves in notebooks #449

Closed
bnmajor opened this issue Nov 3, 2022 · 2 comments
Closed

Await never resolves in notebooks #449

bnmajor opened this issue Nov 3, 2022 · 2 comments

Comments

@bnmajor
Copy link

bnmajor commented Nov 3, 2022

I was hoping that someone might be able to help me out with a stumbling block that I have hit recently... We are trying to add support for the getter functions in itkwidgets, but trying to await the response results in a <FuturePromise Pending> that never resolves and a notebook cell that never exits. It seems that basically any ImJoy api call or plugin api call that needs to be awaited has this issue (can be reproduced in a notebook with the simple example below). I am wondering if I am missing or misunderstanding something or if this is maybe a bug. Thanks!

from imjoy_rpc import api

class ImJoyPlugin():
    async def setup(self):
        pass

    async def run(self, ctx):
        pass

api.export(ImJoyPlugin())

# https://imjoy.io/docs/#/api?id=apiecho
await api.echo('Hello World')

@oeway @thewtex

@oeway
Copy link
Contributor

oeway commented Nov 3, 2022

Unfortunately, we don't have a solution for this for now, due to how jupyter works. See here: ipython/ipykernel#65

Copy my notes here:

Please also note that there is a current limitation with jupyter notebook that the execution will be blocked if you try to run directly await in a cell, see this issue. Instead of doing await my_async_function() directly in a cell, you can do asyncio.ensure_future(my_async_function()).

@bnmajor
Copy link
Author

bnmajor commented Nov 4, 2022

Ah, I was afraid that was the case. This is not an imjoy-rpc issue so I will close this. Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants