用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/HKUDS/OpenSpace --skill code-execution-fallback-e81068命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | code-execution-fallback-e81068 |
| description | Fallback workflow for executing Python code when execute_code_sandbox fails repeatedly |
Use this skill when execute_code_sandbox fails repeatedly (2+ attempts) with unknown, persistent, or unexplained errors. This fallback approach uses write_file + run_shell to save Python scripts to disk and execute them via command line, which has proven more reliable in certain failure scenarios.
Monitor execute_code_sandbox attempts. After 2 consecutive failures with errors like:
Switch to the fallback workflow immediately.
Use write_file to save your Python code as a .py file in the working directory:
write_file(
path="script.py",
content="""
import sys
import json
# Your Python code here
def main():
# Your logic
result = {"status": "success", "data": "example"}
print(json.dumps(result))
if __name__ == "__main__":
main()
"""
)
Tips:
Use run_shell to execute the Python script via command line:
run_shell(
command="python3 script.py",
timeout=60 # Adjust timeout as needed
)
Alternative commands:
python script.py - if python3 alias isn't availablepython3 -u script.py - for unbuffered outputpython3 script.py arg1 arg2 - with argumentsCheck the stdout/stderr from run_shell to:
If the script writes output files, use read_file to retrieve results.
Remove temporary script files if they won't be reused:
run_shell(command="rm script.py")
Scenario: execute_code_sandbox failed twice while trying to process data.
Fallback execution:
# Step 1: Write the processing script
write_file(
path="process_data.py",
content="""
import pandas as pd
import json
def process():
data = [1, 2, 3, 4, 5]
result = {"sum": sum(data), "count": len(data)}
print(json.dumps(result))
# Also save to file for reliability
with open("result.json", "w") as f:
json.dump(result, f)
if __name__ == "__main__":
process()
"""
)
# Step 2: Execute via shell
output = run_shell(command="python3 process_data.py")
# Step 3: Read results from file
results = read_file(file_path="result.json", filetype="json")
| Issue | Solution |
|---|---|
python3: command not found | Try python instead, or check available interpreters with which python |
| Permission denied | Ensure the working directory is writable; write_file creates files in workspace by default |
| Module not found | Install dependencies via run_shell(command="pip install package_name") before execution |
| Script hangs | Increase timeout parameter in run_shell |
| Output too long | Redirect output to file within the script and read it separately |
task_specific_script.py)print(f"Step X complete: {value}")execute_code_sandboxexecute_code_sandbox succeeds consistently (no need to add complexity)Incremental audio production with duration mismatch handling, adaptive stem extension, and pre-mix alignment verification
Audio production with diagnostic analysis, timecode parsing from documents, and verified export workflow
Incremental audio production with duration alignment handling, per-stem verification, and adaptive extension strategies
基于 SOC 职业分类