Codes on https://jupyter.org/try-jupyter/lab/ not working properly anymore

The follow code on Jupyter Lab I’ve written doesn’t work anymore
https://jupyter.org/try-jupyter/lab/

def check_palindrome():
    s = str(input('Enter a word:'))
    s_upper = (s.upper())
    rev_s = s_upper[::-1]

    if s_upper == rev_s:
        print(s, "is a palindrome.")
    else:
        print(s, "is not a palindrome")
        
check_palindrome()

The code prints ’

<Future pending> is not a palindrome 

before I enter the input. After entering the input it doesn’t do anything. I haven’t changed the code at all when it worked

We recently switched some of the try repos to use JupyterLite to reduce the load on mybinder: Https://jupyter.org/try so slow... Why? - #15 by krassowski

JupyterLite has the big advantage that it runs entirely in the browser so won’t run into problems if there are too many users. There are some differences from normal Python though, and using input is a known issue- currently using await is the workaround:

If you want to use the original Python kernel you can try one of Binder Examples · GitHub

1 Like

Yep, the interrupt button doesn’t work either… nor do urllib, subprocesses, turtle, tcl and a raft of other things.

Outside of the standard library, it’s even more exciting, as one might be able to await piplite.install('some-package'), have it “work”, but then be missing some third-party, non-python library: graphviz is a good example.
Some of these might be fixable, in some browsers, and some of the might work with other hacks. But then, there’s stuff in the python standard library that doesn’t work on Windows, properly, so I guess we take what we can get!

At some point in the future, we’re hoping that a wasm-32 target for conda-forge might make some of these more plausible… but still not everything.

2 Likes

Yes, selecting from the ‘Pinned’ options near the top of that page, the requirements example or conda example, and then launching a binder instance using the launch binder badge will get you back to the more typical kernel activity you expect. The launch badge for both will spin up a JupyterLab interface and you can switch back to the classic notebook if you prefer by select from the menubar Help > Launch Classic Notebook.

There’s shortcuts to doing a lot of that if you find it more taxing than just when you would go to TryJupyter and click one of the tiles. For example, using the following URL, or this link, you can launch right into the classic notebook interface for the requirements example with the Jupyter dashboard presented at the start:

http://mybinder.org/v2/gh/binder-examples/requirements/master?urlpath=/tree/

Or with this link you can launch right into the classic notebook interface based on the requirements example with the index.ipynb notebook coming up the start & that URL is:

http://mybinder.org/v2/gh/binder-examples/requirements/master?urlpath=%2Fnotebooks%2Findex.ipynb

You can come back here and select those links or keep the URLs themselves handy.
If you change part of the URL that’s based on the repo name you can alternatively use the conda example as the basis, i.e, change requirements to conda in the URLs.