用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/HKUDS/OpenSpace --skill python-debug-execution命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 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-debug-execution |
| description | Debug Python scripts with proper error surfacing and working directory verification |
When executing Python scripts that may fail, use this pattern to surface clear error information and diagnose issues effectively.
Always run Python scripts with stderr redirected to stdout and echo the exit code:
python3 script.py 2>&1 ; echo Exit code: $?
Why this works:
2>&1 captures both stdout and stderr, ensuring tracebacks are visibleecho Exit code: $? reveals the actual exit status for debuggingBefore any file operations in Python scripts, add working directory verification:
import os
# At the start of your script or before file operations
print(f"Current working directory: {os.getcwd()}")
# For debugging, also list directory contents
print(f"Directory contents: {os.listdir('.')}")
Why this works:
#!/usr/bin/env python3
import os
import sys
def main():
# Diagnostic: verify execution context
print(f"Working directory: {os.getcwd()}")
print(f"Python version: {sys.version}")
print(f"Directory listing: {os.listdir('.')}")
# Your actual logic here
# ...
if __name__ == "__main__":
main()
python3 script.py 2>&1 ; echo Exit code: $?
Look for:
| Symptom | Likely Cause | Debug Clue |
|---|---|---|
| FileNotFoundError | Wrong working directory | Check os.getcwd() output |
| ModuleNotFoundError | Missing dependencies | Traceback shows import path |
| PermissionError | File access issues | Traceback shows file path |
| Silent failure (exit 0, no output) | Logic bug, not crash | Add print statements |