xyliu-cs/openspace-gdpval/pdf-debug-unbuffered
Claude Code and agent skill by xyliu-cs/openspace-gdpval
- community
Checking that the SKILL.md file is still in the repository.
Debug Python PDF generation errors by using unbuffered output and stderr inspection to reveal actual tracebacks
Install
npx vskill@latest install xyliu-cs/openspace-gdpval/pdf-debug-unbufferedSKILL.md
The same SKILL.md was published earlier as zhanghong3721/kimiclaw/pdf-debug-unbuffered.
PDF Generation Debug Technique
When Python PDF libraries (reportlab, fpdf, etc.) fail with generic "unknown error" messages, the actual cause is often hidden due to output buffering or error swallowing. This skill provides a technique to expose the real traceback.
Core Technique
Run the Python script with the -u flag (unbuffered output) and pipe stderr through head to capture the actual error:
Or more specifically, to focus on stderr:
Why This Works
- `-u` flag: Forces Python to run in unbuffered mode, ensuring output (including errors) is flushed immediately rather than held in buffers that may be lost on crash
- `2>&1`: Redirects stderr to stdout so both streams are captured together
- `head`: Limits output to show the most relevant error messages at the top
Step-by-Step Debugging
Step 1: Identify the failing script
Locate the Python script that generates the PDF and is producing generic errors.
Step 2: Run with unbuffered output
Step 3: Analyze the traceback
Look for:
- Import errors (missing dependencies)
- File path issues (invalid paths, permission errors)
- Font registration problems (common with reportlab)
- Memory or resource constraints
Step 4: Fix the underlying issue
Address the specific error revealed in the traceback.
Step 5: Re-run normally
Once fixed, run the script without the debug flags to confirm it works:
Common Issues Revealed
| Symptom | Likely Cause | |
|---|---|---|
| "unknown error" on PDF save | File path doesn't exist or no write permissions | |
| Generic failure during build | Missing font files or font registration issues | |
| Silent crash | ImportError for missing dependencies | |
| Incomplete PDF | Script terminated early due to unhandled exception |
Alternative Approaches
If the above doesn't work, try:
Example: Debugging reportlab
Notes
- This technique applies to any Python script with opaque error messages, not just PDF generation
- The
-uflag is available in Python 2.7+ and all Python 3 versions - For production debugging, consider logging to a file instead of using
head
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggdpval_bench/skills/pdf-debug-unbuffered/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/xyliu-cs/openspace-gdpval/pdf-debug-unbuffered)