[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KJA2960Y8WAXS3DFVY5GN0":3,"skill-same:01M6KJA2960Y8WAXS3DFVY5GN0":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":13,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M6KJA2960Y8WAXS3DFVY5GN0","pdf-debug-unbuffered",null,"Debug Python PDF generation errors by using unbuffered output and stderr inspection to reveal actual tracebacks","AG064\u002FOpenSpace","AG064","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184930299?v=4","01M6KHVFG7TB73NHX3RDYSTMH2","01M6KHVFMM7XA2PZA9Z83PHS3V",0,"MIT","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-debug-unbuffered\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[28,29,30,31,32,33,34,35,36],"PDF","debug","pdf debug","pdf debug unbuffered","python","generation","pdf generation","output","errors","2026-11-10 10:12:30",false,"---\nname: pdf-debug-unbuffered\ndescription: Debug Python PDF generation errors by using unbuffered output and stderr inspection to reveal actual tracebacks\n---\n\n# PDF Generation Debug Technique\n\nWhen 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.\n\n## Core Technique\n\nRun the Python script with the `-u` flag (unbuffered output) and pipe stderr through `head` to capture the actual error:\n\n```bash\npython -u your_script.py 2>&1 | head -100\n```\n\nOr more specifically, to focus on stderr:\n\n```bash\npython -u your_script.py 2>&1 | head -50\n```\n\n## Why This Works\n\n1. **`-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\n2. **`2>&1`**: Redirects stderr to stdout so both streams are captured together\n3. **`head`**: Limits output to show the most relevant error messages at the top\n\n## Step-by-Step Debugging\n\n### Step 1: Identify the failing script\nLocate the Python script that generates the PDF and is producing generic errors.\n\n### Step 2: Run with unbuffered output\n```bash\npython -u generate_pdf.py 2>&1 | head -100\n```\n\n### Step 3: Analyze the traceback\nLook for:\n- Import errors (missing dependencies)\n- File path issues (invalid paths, permission errors)\n- Font registration problems (common with reportlab)\n- Memory or resource constraints\n\n### Step 4: Fix the underlying issue\nAddress the specific error revealed in the traceback.\n\n### Step 5: Re-run normally\nOnce fixed, run the script without the debug flags to confirm it works:\n```bash\npython generate_pdf.py\n```\n\n## Common Issues Revealed\n\n| Symptom | Likely Cause |\n|---------|--------------|\n| \"unknown error\" on PDF save | File path doesn't exist or no write permissions |\n| Generic failure during build | Missing font files or font registration issues |\n| Silent crash | ImportError for missing dependencies |\n| Incomplete PDF | Script terminated early due to unhandled exception |\n\n## Alternative Approaches\n\nIf the above doesn't work, try:\n\n```bash\n# Capture full stderr to a file\npython -u script.py 2> error.log\n\n# Use Python's traceback module explicitly\npython -c \"import traceback; exec(open('script.py').read())\" 2>&1\n\n# Run with verbose import tracing\npython -v -u script.py 2>&1 | head -200\n```\n\n## Example: Debugging reportlab\n\n```bash\n# Before: Generic error\npython create_checklist.py\n# Output: \"Error: unknown\"\n\n# After: Actual traceback  \npython -u create_checklist.py 2>&1 | head -50\n# Output: \"FileNotFoundError: [Errno 2] No such file or directory: '\u002Ffonts\u002FHelvetica.ttf'\"\n```\n\n## Notes\n\n- This technique applies to any Python script with opaque error messages, not just PDF generation\n- The `-u` flag is available in Python 2.7+ and all Python 3 versions\n- For production debugging, consider logging to a file instead of using `head`","# PDF Generation Debug Technique\n\nWhen 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.\n\n## Core Technique\n\nRun the Python script with the `-u` flag (unbuffered output) and pipe stderr through `head` to capture the actual error:\n\n```bash\npython -u your_script.py 2>&1 | head -100\n```\n\nOr more specifically, to focus on stderr:\n\n```bash\npython -u your_script.py 2>&1 | head -50\n```\n\n## Why This Works\n\n1. **`-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\n2. **`2>&1`**: Redirects stderr to stdout so both streams are captured together\n3. **`head`**: Limits output to show the most relevant error messages at the top\n\n## Step-by-Step Debugging\n\n### Step 1: Identify the failing script\nLocate the Python script that generates the PDF and is producing generic errors.\n\n### Step 2: Run with unbuffered output\n```bash\npython -u generate_pdf.py 2>&1 | head -100\n```\n\n### Step 3: Analyze the traceback\nLook for:\n- Import errors (missing dependencies)\n- File path issues (invalid paths, permission errors)\n- Font registration problems (common with reportlab)\n- Memory or resource constraints\n\n### Step 4: Fix the underlying issue\nAddress the specific error revealed in the traceback.\n\n### Step 5: Re-run normally\nOnce fixed, run the script without the debug flags to confirm it works:\n```bash\npython generate_pdf.py\n```\n\n## Common Issues Revealed\n\n| Symptom | Likely Cause |\n|---------|--------------|\n| \"unknown error\" on PDF save | File path doesn't exist or no write permissions |\n| Generic failure during build | Missing font files or font registration issues |\n| Silent crash | ImportError for missing dependencies |\n| Incomplete PDF | Script terminated early due to unhandled exception |\n\n## Alternative Approaches\n\nIf the above doesn't work, try:\n\n```bash\n# Capture full stderr to a file\npython -u script.py 2> error.log\n\n# Use Python's traceback module explicitly\npython -c \"import traceback; exec(open('script.py').read())\" 2>&1\n\n# Run with verbose import tracing\npython -v -u script.py 2>&1 | head -200\n```\n\n## Example: Debugging reportlab\n\n```bash\n# Before: Generic error\npython create_checklist.py\n# Output: \"Error: unknown\"\n\n# After: Actual traceback  \npython -u create_checklist.py 2>&1 | head -50\n# Output: \"FileNotFoundError: [Errno 2] No such file or directory: '\u002Ffonts\u002FHelvetica.ttf'\"\n```\n\n## Notes\n\n- This technique applies to any Python script with opaque error messages, not just PDF generation\n- The `-u` flag is available in Python 2.7+ and all Python 3 versions\n- For production debugging, consider logging to a file instead of using `head`",{"name":5,"description":7},"main","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Fpdf-debug-unbuffered","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace","https:\u002F\u002Fgithub.com\u002FAG064","AG064, E.Mi.\r\n\r\nA person who thinks all the time, yet all they have to think about is nothing. I want to improve the world and work on open source projects","2026-10-08 06:53:48",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add AG064\u002FOpenSpace --skill pdf-debug-unbuffered",{"tool":55,"command":56},"bunx","bunx skills add AG064\u002FOpenSpace --skill pdf-debug-unbuffered",{"tool":58,"command":59},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill pdf-debug-unbuffered","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-debug-unbuffered\u002FSKILL.md",true,[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},".skill_id","OTHER","其他",34,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-debug-unbuffered\u002F.skill_id",[70,91,108,117,145,161],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":37},"01M6KKMPWA0B5SCCH766F8M5EA","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[77,78,79,80,81,82,83,36,84,35,85,86,87,88,89,32,90],"write special chars ts check","check","write","filters","Existing","type-checking","for","script","type","files","only","template","file","typescript",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":37},"01M6KKMJXVBNVEY3TRK055F4A7","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[98,99,79,88,100,101,89,32,102,103,104,105,106,83,84,107],"readback","write special chars readback","cleanup","read","scripts","verification","via","post","helper","with",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":37},"01M6KKMEGX9M9NC105J0W3Q5B9","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[79,115,32,83,104,88,116,89,84],"write special chars heredoc","shell",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":126,"publishedAt":37},"01M6KKM8EJ2AATVHZBNB916WT0","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[123],{"categoryNo":124,"categoryName":125,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000033","数据分析师",[127,128,129,130,90,131,132,133,134,135,83,136,137,138,139,140,141,142,143,144],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","data","scheduler",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":37},"01M6KKM39PHYK627F19GE2B9XN","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[152,153,154,155,83,156,107,157,158,159,160],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":167,"publishedAt":37},"01M6KKKY7T2P61Y0JH54CDEJKQ","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[168,169,170,171,172,173,89,174,175,176],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]