mirror of
https://github.com/johndoe6345789/snippet-pastebin.git
synced 2026-04-24 13:34:55 +00:00
Generated by Spark: It doesnt pause to let me type: Welcome to the greeting program!
Hello, <coroutine object custom_input at 0xc4e9c8>! Nice to meet you! Wow, <coroutine object custom_input at 0xc4f600> years old! That's awesome! <coroutine object custom_input at 0xaf4cc0> is a great choice! I love that color too. Thanks for chatting, <coroutine object custom_input at 0xc4e9c8>! Have a wonderful day!
This commit is contained in:
@@ -140,14 +140,23 @@ sys.stderr = InteractiveStderr(__error_callback__)
|
||||
await pyodide.runPythonAsync(`
|
||||
import builtins
|
||||
from pyodide.ffi import to_js
|
||||
import asyncio
|
||||
|
||||
async def custom_input(prompt=""):
|
||||
def custom_input(prompt=""):
|
||||
import sys
|
||||
sys.stdout.write(prompt)
|
||||
sys.stdout.flush()
|
||||
|
||||
result = await js_input_handler(prompt)
|
||||
return result
|
||||
async def get_input():
|
||||
result = await js_input_handler(prompt)
|
||||
return result
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
if loop.is_running():
|
||||
import pyodide.webloop
|
||||
return pyodide.webloop.WebLoop().run_until_complete(get_input())
|
||||
else:
|
||||
return loop.run_until_complete(get_input())
|
||||
|
||||
builtins.input = custom_input
|
||||
`)
|
||||
|
||||
Reference in New Issue
Block a user