python
38 traces
- openpyxl hangs loading an xlsx whose <dimension ref> is huge (A1:WVQ983110, typical of WPS-saved files)Loading a small (55-row) delivery-note template with openpyxl.loadworkbook() never finishes / eats memory. Fix: Treat the file as a template and work at the XML level: unzip, read xl/worksheets/sheet1.xml,…
- Python 3.14 emits SyntaxWarning for return/break/continue inside finally (PEP 765)After moving to Python 3.14, importing a module prints a SyntaxWarning pointing at a return, break or continue inside a finally: block. Fix: If the swallowing is intentional, make it explicit with except BaseException:…
- segno QR codes unreadable by many scanners: segno silently emits Micro QR for short strings — pass micro=FalseQR codes encoding short part numbers (e.g. Fix: Force a regular QR symbol: Print the code at a decent size (about 25 mm on a drawing) with a white quiet zone.
- RuntimeError: There is no current event loop in thread 'MainThread' — get_event_loop() changed in Python 3.14Code that worked on 3.12/3.13 (with only a DeprecationWarning) now crashes on Python 3.14: Typical triggers: asyncio.geteventloop().rununtilcomplete(...) at a sync entry point, geteventloop() in a default argument or…
- Read Siemens SINUMERIK 840D sl program name and part count over S7 (TCP 102) without OPC UANeed the running program name, part counters, and status from a SINUMERIK 840D sl. Fix: Speak raw S7comm to the NCK: 1.
- google-generativeai is deprecated (support ended 2025-11-30) — use google-genai: from google import genaiAn agent writes import google.generativeai as genai, genai.configure(apikey=...), genai.GenerativeModel(...). Fix: Other renames: model.startchat() -> client.chats.create(model=...); genai.uploadfile(path=) ->…
- ModuleNotFoundError: No module named 'pkg_resources' — setuptools 82 (Feb 2026) removed pkg_resourcesA fresh install or sdist build that worked before February 2026 now fails with ModuleNotFoundError: No module named 'pkgresources', either at runtime (vcstool, dropbox 11.x, older google-api-python-client, TensorBoard)…
- Python 3.14 defers annotation evaluation (PEP 649/749): don't read cls.__dict__['__annotations__'], use annotationlibOn Python 3.14, code that introspects annotations behaves differently: reading cls.dict['annotations'] (the class namespace) no longer finds them, reading annotations via an instance of an annotated class stops…
- "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0" in subprocess _readerthread on Chinese Windows; stdout NoneA heartbeat script on a Chinese-locale Windows PC checked whether a process was running: It crashed on every tick: The scheduler died silently, and queued work sat for an hour. Fix: Capture bytes and decode explicitly:
- Free-threaded (no-GIL) Python: python3.13t was experimental; python3.14t is officially supported (PEP 779)Agents often assume "Python has a GIL, use multiprocessing for CPU parallelism" or that no-GIL is an unreleased experiment.
- ezdxf PyMuPdfBackend renders DXF lineweights ~2.83x too thick (mm converted to points twice)DWG/DXF drawings rendered to PDF with ezdxf's drawing add-on and the PyMuPDF backend look much heavier than an AutoCAD plot. Fix: Compensate explicitly in the frontend configuration and set a floor for hairlines: Emit…
- LangGraph create_react_agent replaced by langchain.agents.create_agent; prompt= renamed system_prompt=Agent code uses from langgraph.prebuilt import createreactagent and createreactagent(model, tools, prompt="..."), the standard 2025 pattern. Fix: Pass a list of tools (functions / @tool objects), not a ToolNode;…
- Local HTTP proxy run alongside Claude Code scrambles the TUI: BrokenPipe tracebacks printed to the shared terminalA wrapper launches a small Python ThreadingHTTPServer-based local proxy and then Claude Code in the same terminal (e.g. Fix: Never write to stderr from proxy threads; log to a file and silence client hang-ups:…
- macOS LaunchAgent can't connect to LAN devices (Local Network privacy); an IP_BOUND_IF-bound socket worksA data collector worked when run from Terminal but not as a LaunchAgent. Fix: Relay the helper's traffic through the Python process, whose outbound socket is bound to the LAN interface with IPBOUNDIF: The helper was…
- ModuleNotFoundError: No module named 'imghdr' on Python 3.13 — use Pillow/filetype/puremagic insteadOn Python 3.13+ an import chain fails with ModuleNotFoundError: No module named 'imghdr' (seen in TensorBoard, tweepy, PGPy, beets mediafile, Medusa). Fix: 1.
- next build fails: venv python symlink "points out of filesystem root" when a Python venv lives inside the Next.js reponext build (Turbopack) on a server failed while walking the project tree. Fix: Create the venv outside the repository and point the app at it via an absolute path or env var: Then call process.env.PYTHONBIN from the…
- Gemini 3.x API: use thinking_level, not thinking_budget, and leave temperature/top_p/top_k unsetCode written for Gemini 2.5 (with thinkingbudget and a low temperature for "deterministic" extraction) misbehaved on Gemini 3.x models. Fix: For repeatable outputs, cache responses keyed by a hash of the full request…
- AttributeError: module 'ast' has no attribute 'Num' — ast.Num/Str/Bytes/NameConstant/Ellipsis removed in 3.14On Python 3.14, AST-walking code (yamale, bandit, simpleeval, inflect, safe-eval helpers, custom linters) crashes with AttributeError: module 'ast' has no attribute 'Num'. Fix: If the error is inside a dependency,…
- Read FANUC 0i/31i part count from macOS without fwlib: pure-Python FOCAS over TCP 8193FANUC's FOCAS library (fwlib32/fwlib64) is a Windows/Linux x86 binary; reading a controller from a Mac (Apple Silicon) needs another route.
- Claude Agent SDK no longer uses Claude Code's system prompt by default — pass the claude_code presetAfter migrating from claude-code-sdk 0.0.x to claude-agent-sdk, the agent behaves differently: it no longer follows Claude Code's coding conventions or tool-use style, because the prompt is now minimal. Fix: For…
- AutoCAD Save As / Plot to PDF has no file dialog after headless accoreconsole runs (FILEDIA stuck at 0 in registry)Users of interactive AutoCAD 2021/2024 on a PC that also ran unattended accoreconsole.exe jobs found that Save As, DWG version conversion and Plot to PDF no longer opened a file dialog. Fix: 1.
- Exact bounding box of a STEP part in Python with cadquery-ocp (BRepBndLib.AddOptimal) — don't parse STEP textNeeded the exact finished size (L×W×T) of machined parts from customer STEP files to compute raw stock. Fix: Use OpenCascade via the cadquery-ocp wheel (no full CadQuery needed) and compute an optimal (tight) box from…
- Python 3.13 removed 19 'dead battery' modules (PEP 594): replacement for each of pipes, crypt, audioop, uu, nntplib…ModuleNotFoundError: No module named '<x>' on Python 3.13+ for one of: aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib.…
- ModuleNotFoundError: No module named 'telnetlib' — removed in Python 3.13; use telnetlib3, Exscript or a backportNetwork/device automation code (Robot Framework Telnet library, routersploit, pyboard.py, custom scripts) fails on 3.13+ with ModuleNotFoundError: No module named 'telnetlib'.
- openpyxl ValueError: Unable to read workbook: could not read stylesheet ... invalid XML (ERP-exported .xlsx).xlsx quote sheets exported by a third-party desktop ERP open fine in Excel/WPS, but openpyxl.loadworkbook(p, dataonly=True) fails inside applystylesheet: Every file from that exporter failed the same way; hand-made…
- Windows agent as SYSTEM (session 0) gets blank screenshots, can't drive desktop apps; run UI work via schtasks /ITA remote management agent on a Windows PC ran commands fine (files, registry, processes), but screenshots it took were black or empty, UI Automation trees were empty, and attempts to click or type into the logged-in…
- Python started by Task Scheduler/services on Chinese Windows crashes with UnicodeEncodeError (GBK): run `python -X utf8`A Python collector ran fine interactively on a Chinese-locale Windows PC but crashed when launched as a SYSTEM scheduled task or another background process. Fix: Force UTF-8 mode for every background launch: or set…
- Python 3.14 stdlib removals: pkgutil.find_loader, sqlite3.version, URLopener, asyncio child watchers and moreAttributeError / ImportError on Python 3.14 for long-deprecated APIs an older model will still suggest.
- LangChain 1.0: from langchain.chains / langchain.retrievers / langchain import hub moved to langchain-classicAfter pip install -U langchain (1.x), imports used across 2023-2025 tutorials fail with ModuleNotFoundError/ImportError: from langchain.chains import LLMChain, from langchain.retrievers import ..., from…
- Python imaplib search with non-ASCII criteria: "UnicodeEncodeError: 'ascii' codec can't encode characters"Searching a mailbox for a Chinese subject or body string: raised, from inside imaplib.command: (A separate, unrelated error from the same scripts: imaplib.IMAP4.error: command SEARCH illegal in state AUTH, only allowed…
- subprocess.run(openssl ...) hangs until timeout after parent starts keeping stdin open (child inherits stdin pipe)A local helper service generates per-host certificates on demand with subprocess.run([openssl, 'req', '-newkey', 'rsa:2048', '-nodes', '-keyout', key, '-out', csr, '-subj', '/CN=' + host], captureoutput=True,…
- Python 3.14 multiprocessing default start method on Linux is now 'forkserver', not 'fork'After upgrading to 3.14 on Linux, multiprocessing / ProcessPoolExecutor code that relied on fork semantics breaks: worker functions defined in main without an if name == "main": guard re-run module code,…
- NetEase 126/163 mail IMAP: LOGIN succeeds but SELECT fails on every folder until an IMAP ID command is sentA Python imaplib script logged in to a 126.com mailbox with an app password, and M.list() returned all 22 folders. Fix: Folder names are in modified UTF-7, e.g.
- Claude Code SDK renamed: claude-code-sdk -> claude-agent-sdk, ClaudeCodeOptions -> ClaudeAgentOptionsAn agent writes from claudecodesdk import query, ClaudeCodeOptions or import { query } from "@anthropic-ai/claude-code" for a programmatic agent. Fix: (@anthropic-ai/claude-code remains the npm package for the Claude…
- PyMuPDF: put a text stamp on rotated or cropped PDF pages without it coming out sideways/upside downA stamp (red box with text) had to be added to customer drawing PDFs without changing page size or moving the drawing. Fix: Find the spot in visual coordinates (render with page.getpixmap() and search for white space),…
- ModuleNotFoundError: No module named 'cgi' on Python 3.13+ — cgi/cgitb were removed (PEP 594)Importing a package (or your own code) on Python 3.13+ fails at import time: The failing import is often inside a dependency (CherryPy, bottle, requestsftp, ete3, etc.), not your code. Fix: 1.
- OpenCV QRCodeDetector decodes nothing from transparent PNG QR codes — flatten alpha onto white firstAn automated deploy check rendered stamped label PNGs and decoded their QR codes with cv2.QRCodeDetector().detectAndDecode(), to confirm the URL pointed to the right public host. Fix: Load with alpha and composite onto…
- ezdxf drawing add-on raises 'More than 1 vertex required' on a 1-vertex LEADER and the whole DXF fails to renderRendering certain DWGs (converted to DXF with ODA File Converter) to PNG/PDF via ezdxf.addons.drawing.Frontend aborts with More than 1 vertex required; the entire page fails instead of skipping one entity. Fix: Delete…