“未来待处理”:为什么我可以在jupyterlab中执行用户输入?
当我尝试执行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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我的评论中回答了一个措辞不好的问题在这里。 (该问题的语言在基本问题上没有解决;在这里,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()
.