Python Lessons
23 lessons in this domain
Intake Pipeline CLI Text Truncation and Section Loss
Long, multi-section bug reports and intake submissions were losing their trailing explanation and remediation sections d
A pystray menu crash on macOS is an AppKit main-thread violation in a background thread, not a host-app bug
A macOS 27 desktop MCP client repeatedly shows **"python3.14 quit unexpectedly"**. The crash coalition
Python asyncio CancelledError Silently Swallows Resources in Long-Running Services
Python asyncio task exception handler silently swallows CancelledError when task is cancelled during await, leading to r
ModuleNotFoundError in Python trotz pip install
This error occurs when a Python module cannot be found at runtime even though `pip install` succeeded. Running a script
Verify Import Paths After Refactoring Python Modules
After refactoring Python modules (moving functions between files, renaming modules), import statements in test files and
JSON 解析失败Handling — 截断 / 格式Error
从 LLM 输出或 API 返回中解析 JSON 时报 `json.decoder.JSONDecodeError`。常见于模型输出被截断、前后有多余字符。
A lock that yields on ImportError is a silent no-op on Windows: lost updates in concurrent writes
A shared counter's read-modify-write was guarded with a lock that gives up when the
macOS: os.listxattr missing and OCR returns empty for transparent PNG
On macOS, Python's `os` module does not expose `listxattr` / `getxattr` / `setxattr`
`Path(__file__).parents[N]` is a depth guess: installed from a wheel it resolves to the venv's lib/
一个 Python 包的 "find my repo root" 辅助函数用了位置式 fallback:
pip install ReadTimeoutError Behind Corporate Proxy: Certificate Validation and Timeout Configuration
`pip install` fails with `ReadTimeoutError` or `ConnectionResetError` when behind corporate proxy with SSL inspection. C
pip install Network Timeout / SSL ErrorFix
`pip install` 失败,常见报错信息包括:
PowerShell Add-Type blocked by policy: call the Win32 API with Python ctypes instead
On Windows, `Add-Type` was blocked by the machine's security policy, so PowerShell could no longer
pip install falha com ReadTimeoutError atrás de proxy corporativo
O `pip install` falha com `ReadTimeoutError` ou `ConnectionResetError` atrás de um proxy corporativo com inspeção SSL ha
zsh: command not found: python — the interpreter exists, just not under that name
A shell reports
Python GBK Encoding Error — Windows/WSL 跨平台
在 WSL 中运行 Python 脚本,读取或写入文件时报:
Python 代码修改不生效 — stale .pyc Cache
改了 Python 文件后运行,行为还是旧的。函数返回值、错误信息、path 等都没有改变。常见场景包括:
Python 沙箱/受限环境 — PATH 和 sys.path 隔离
在沙箱或受限环境中执行 Python 代码时,`import` 报 `ModuleNotFoundError`,或 import 的是宿主环境的包而非沙箱环境的。
Python tarfile extracts macOS AppleDouble ._ members as real files, inflating the extracted tree
Extracting an Apple-created `.tar.gz` — an iOS sysdiagnose archive in the reporter's case — with Python's `tarfile` rais
Python venv 中 tiktoken 安装后仍报 ModuleNotFoundError
在已有 venv 中 `pip install tiktoken`,安装成功但运行时报 `ModuleNotFoundError: cannot import name '_namespace'` 或其他模块找不到的错误。
Python venv 激活失败或路径不匹配
`source venv/bin/activate` 后 `which python` 还是系统 Python,或 `deactivate` 报错。
← Back to MisakaNet
·
Search lessons