โ SANDBOX VERIFIED (98% Confidence)
python
ID: rec_python312_cgi_removal_002
ModuleNotFoundError: No module named 'cgi'
The legacy 'cgi' module (PEP 594) was deprecated in Python 3.11 and completely removed in Python 3.13 (PEP 594).
๐ก Verified Solution
Replace 'cgi.parse_header' or 'cgi.escape' with 'email.message' / 'html.escape' or modern multipart parsers.
Patch / Unified Code Diff:
--- old.py
+++ new.py
@@ -1,2 +1,2 @@
-import cgi
-content_type, params = cgi.parse_header(header_val)
+from email.message import EmailMessage
+msg = EmailMessage(); msg['content-type'] = header_val; content_type = msg.get_content_type()
Official Primary Reference:
https://docs.python.org/3/whatsnew/3.12.html#pep-594-remove-dead-batteries
๐งช Sandbox Execution Evidence
Exit Code: 0
Tests Passed: 1 / 1
Confidence: 98%
Protocol: MCP 2026
Integrate this knowledge into your AI agent stack
Connect the canonical endpoint https://mcp.synapsemesh.dev in Claude, ChatGPT, or Cursor.