Spaces:
Sleeping
Sleeping
Updating python block
Browse files
utils.py
CHANGED
|
@@ -45,7 +45,8 @@ def _execute_python(code: str, stdin: str) -> Tuple[str, str, str]:
|
|
| 45 |
with capture_output() as (stdout, stderr):
|
| 46 |
try:
|
| 47 |
inputs = iter(stdin.splitlines())
|
| 48 |
-
|
|
|
|
| 49 |
exec(code, {}, local_vars)
|
| 50 |
return stdout.getvalue().strip(), stderr.getvalue().strip(), None
|
| 51 |
except Exception as e:
|
|
|
|
| 45 |
with capture_output() as (stdout, stderr):
|
| 46 |
try:
|
| 47 |
inputs = iter(stdin.splitlines())
|
| 48 |
+
input_override = lambda prompt='': next(inputs, '')
|
| 49 |
+
local_vars = {"input": input_override}
|
| 50 |
exec(code, {}, local_vars)
|
| 51 |
return stdout.getvalue().strip(), stderr.getvalue().strip(), None
|
| 52 |
except Exception as e:
|