Lara
Lara

Reputation: 1

"Future Pending": Why can't I execute user input in JupyterLab?

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

Upvotes: 0

Views: 6912

Answers (1)

Wayne
Wayne

Reputation: 9994

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().

Upvotes: 1

Related Questions