{
  "id": "python/matplotlib-plot-directory-error",
  "signature": "FileNotFoundError: [Errno 2] No such file or directory: '/nonexistent/path/figure.png'",
  "signature_zh": "FileNotFoundError: [Errno 2] 没有那个文件或目录: '/nonexistent/path/figure.png'",
  "regex": "FileNotFoundError:\\ \\[Errno\\ 2\\]\\ No\\ such\\ file\\ or\\ directory:\\ '/nonexistent/path/figure\\.png'",
  "domain": "python",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "Attempting to save a figure to a directory that does not exist.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试将图形保存到不存在的目录。",
  "versions": [
    {
      "version": "3.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using a relative path without checking current working directory",
      "why_fails": "If the relative path points to a non-existent directory, the error persists.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Creating the file manually before saving",
      "why_fails": "The directory must exist; creating the file alone does not create parent directories.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create the directory before saving",
      "success_rate": 0.95,
      "how": "import os; os.makedirs('/nonexistent/path', exist_ok=True); plt.savefig('/nonexistent/path/figure.png')",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a valid existing directory",
      "success_rate": 0.9,
      "how": "plt.savefig('./figure.png')",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}