Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -263,7 +263,7 @@ def run_python_script(file_path: Union[str, Path]) -> str:
|
|
| 263 |
if path_obj.stat().st_size == 0: return f"ERROR: Python script {file_path} empty."
|
| 264 |
try:
|
| 265 |
logging.info(f"Executing Python script: {file_path}"); python_exe = sys.executable or "python"
|
| 266 |
-
process = subprocess.run([python_exe, str(file_path)], capture_output=True, text=True, encoding='utf-8', timeout=
|
| 267 |
stdout = process.stdout.strip() if process.stdout else ""; stderr = process.stderr.strip() if process.stderr else ""
|
| 268 |
if process.returncode != 0: logging.error(f"Script {file_path} failed (Code {process.returncode}): {stderr}"); return f"ERROR: Script failed code {process.returncode}." + (f" Err: {stderr[:200]}" if stderr else "")
|
| 269 |
if not stdout:
|
|
|
|
| 263 |
if path_obj.stat().st_size == 0: return f"ERROR: Python script {file_path} empty."
|
| 264 |
try:
|
| 265 |
logging.info(f"Executing Python script: {file_path}"); python_exe = sys.executable or "python"
|
| 266 |
+
process = subprocess.run([python_exe, str(file_path)], capture_output=True, text=True, encoding='utf-8', timeout=60, check=False)
|
| 267 |
stdout = process.stdout.strip() if process.stdout else ""; stderr = process.stderr.strip() if process.stderr else ""
|
| 268 |
if process.returncode != 0: logging.error(f"Script {file_path} failed (Code {process.returncode}): {stderr}"); return f"ERROR: Script failed code {process.returncode}." + (f" Err: {stderr[:200]}" if stderr else "")
|
| 269 |
if not stdout:
|