JupiterLab input() function not working

I’m just starting with JupiterLab online and cannot get input() statements to work. For example:

xa= await(input(“xa=”))
print(xa)
ya= await(input(“ya=”))
print(xa,ya)

I added the “await” function because although a prompt appeared without it, the code seemed to proceed after the input statement. Now, I’m not sure what is happening. I can enter an input once, but a second prompt never appears. It seems to hang the process. Any insight would be appreciated.

Yep: if you’re using JupyterLite (little light bulb in the corner) there are some point bits:

Try splitting that up into two cells, and it might work.

Getting out of python, and into browser specs and WASM:

There’s… things we’ll be able to do to make it block, but it will either be:
a) really dirty, as we have done to make browser, server, and kernel files look “the same” without await everywhere
b) a while before the browsers support it, where Promises will be understood

Thanks, I’ll look into those workarounds. Or if the problem wouldn’t exist with a locally installed Jupyter, I can certainly try installing it - just trying to keep it simple as possible to begin with. My first goal is to write python code that is compatible with my calculator that runs python so I can develop under Windows 10 and load it into the calculator. I don’t know how involved it is to install Jupyter locally (or exactly what “Jupyter” comprises).

Alternatively, you can use a typical, full Python kernel in JupyterLab by accessing it differently. The other options at the Try Jupyter page are served via the MyBinder service. You can tell by hovering over the other tiles and seeing ‘mybinder.org’ at the start of the URL. To save resources the two most popular were changed to JupyterLite to still give a sense of the interface but take demand off the service which runs on remote machines and therefore costs money. You can though opt in the full Python kernel backed offerings.

To do that:
Go here and press ‘launch binder’. You’ll get a temporary session on a remote computer without logging in. Using configuration files you can even control what is already installed, see here. Keep in mind the sessions are temporary and will time out with inactivity. And so be sure to download anything useful you make back to your local machine promptly. You can drag-and-drop from your local machine into the left side browser panel when you start a new session to pick up again later.