用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/HKUDS/OpenSpace --skill python-shell-fallback命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
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 职业分类
正在显示 SKILL.md
| name | python-shell-fallback |
| description | Fallback to shell execution when sandbox fails for library-dependent Python code |
When execute_code_sandbox fails for Python code that depends on external libraries, use run_shell with a heredoc Python script as a reliable fallback. The shell environment typically has better access to installed packages and system configuration than the sandbox.
Apply this skill when:
execute_code_sandbox returns errors related to missing libraries (e.g., ModuleNotFoundError)Check if the sandbox error indicates a library/dependency issue:
ModuleNotFoundError: No module named 'xxx'ImportError: cannot import name 'xxx'Rewrite the code execution using run_shell with a heredoc:
python3 << 'EOF'
# Your Python code here
import library_name
# ... rest of code
EOF
Call run_shell with the heredoc Python script:
command: python3 << 'EOF'
import reportlab
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
# Your library-dependent code here
c = canvas.Canvas("output.pdf", pagesize=letter)
c.drawString(100, 750, "Hello World")
c.save()
EOF
Sandbox attempt (fails):
# execute_code_sandbox call fails with:
# ModuleNotFoundError: No module named 'reportlab'
Shell fallback (works):
python3 << 'EOF'
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
c = canvas.Canvas("legal_memo.pdf", pagesize=letter)
c.setTitle("Legal Memorandum")
c.drawString(100, 750, "CONFIDENTIAL LEGAL MEMORANDUM")
c.save()
print("PDF created successfully")
EOF
<< 'EOF') - Prevents variable expansion, keeping Python code intactrun_shell to confirm successFor simple one-liners or short scripts:
python3 -c "import reportlab; print(reportlab.__version__)"
If shell execution also fails:
which python3pip3 list | grep package_namepython instead of python3 (some systems differ)pip3 install package_name