with one click
python-shell-fallback
Fallback to shell execution when sandbox fails for library-dependent Python code
Menu
Fallback to shell execution when sandbox fails for library-dependent Python code
| 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_nameDelegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.
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
Step-by-step audio production with per-stem verification, timing alignment, and incremental quality gates
End-to-end audio production workflow with stems, effects, archiving, and verification