How can I solve this simple error?

hello every one…
what is the problem with this error?

----> 1 a = int (input())

TypeError: int() argument must be a string, a bytes-like object or a real number, not ‘PyodideFuture’

when I coded in windows I didn’t see this error! but in Mac I faced with up error
thanks

You aren’t probably running this on your mac. Or at least not the traditional way you may expect. In other words, it would happen if you ran it the same way on Windows I suspect.

I suspect on Windows you had installed Jupyter and were using a typical Python kernel on Windows? Here it seems you are using on your Mac JupyterLite/Pyodide kernel. That actually isn’t running directly in Python on your Mac in the traditional way. It is running in a Pyodide kernel that is running in WebAssembly in your browser actually. There are limitations at this time(see more about this below).

Therefore, for JupyterLite and the Pyodide kernel try editing your code to add this await, like so:

a = int (await input())

This solution is based on here. Which is referenced from How to use int(input()) in JupyterLite / Pyodide Kernel .

Further Details and an Alternative to Adjusting Your Code:
Note that JupyterLite is still labeled as Experimental. See ‘Status’ here where it warns, “Not all the usual features available in JupyterLab and the Classic Notebook will work with JupyterLite” and on the Try Jupyter page, note the ‘Experimental’ warning highlighted.
You can use MyBinder for a typical Python-based kernel online without signing in or installing anything on your machine. Go here and click ‘Launch Binder’ or just click here to launch a temporary session. You can drag and drop into the file navigation panel on the left side to upload your in-progress Jupyter .ipynb file from your local computer to the remote temporary session. Keep in mind though this a temporary session on a remote virtual computer; there is no persistence, and so you want to download anything useful you make back to your local system ASAP.

ooo thanks man …
you right, its working
very well

1 Like