“未来待处理”:为什么我可以在jupyterlab中执行用户输入?

发布于 2025-02-11 01:53:43 字数 431 浏览 1 评论 0原文

当我尝试执行input()函数以生成JupyterLab中的用户输入时,它总是会给我以下语句:“从未检索过未来的异常。”

例如:

number = input("enter a number: ")
print(number)

我回来了:

从未检索到未来的例外 未来:<未来完成的异常= jsexception(typeError:无法读取null的属性(读取'sendInputRequest'))> >未来待处理>

我已经尝试重新启动所有内容,并尝试使用raw_input()

我正在使用 pyolite 内核。 CSS-Loader是版本v5.2.7

When I try to execute an input() function to generate user input in JupyterLab, it always gives me back the following statement: "Future exception was never retrieved."

For example:

number = input("enter a number: ")
print(number)

I got back:

Future exception was never retrieved
future: <Future finished exception=JsException(TypeError: Cannot read properties of null (reading 'sendInputRequest'))> >Future pending>

I have already tried to restart everything as well as I have tried to use raw_input() instead.

I am using the pyolite Kernel. The css-loader is Version v5.2.7

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一生独一 2025-02-18 01:53:43

在我的评论中回答了一个措辞不好的问题在这里。 (该问题的语言在基本问题上没有解决;在这里,OP的问题显然是问题的核心。)

您应该能够添加等待 ,如所述

更新:一种与Jupyterlite兼容的新内核,Xeus-Python是 nofollow noreferrer>一个与time.sleep()一起使用。

This is been answered in my comment in a poorly worded question here. (The language of that question doesn't address at the underlying issue; OP's question here clearly does get to the heart of the issue.)

You should be able to add await as described here. It is one of the many issues with JupyterLite/pyolite, see here and the bottom section here listing several current issues encountered to illustrate how experimental JupyterLite/pyolite is. Unless you absolutely need this to run inside the browser on the client machine using web assembly, at the time you'd probably have a better experience using a typical Python kernel via temporary sessions served in the user's browser backed on remote machines provided my the MyBinder service.

UPDATE: A new kernel compatible with JupyterLite, xeus-python, was announced. That one works with time.sleep().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文