Desk Clarity

A field guide to everyday digital problems.

The guidebook / 181 guides

Developer tools

Code, configuration and workflows. Source-linked checks to help you move forward.

Developer tools · GUIDE

Python Regex Returns Groups Instead of Full Matches: Inspect the Result Shape

Adding parentheses changes findall results or inserts delimiters into split output.

2 min readSource-linked guide
Developer tools · GUIDE

Python SQLite With Block Leaves the Connection Open: Close It Explicitly

A sqlite3 connection still accepts queries after leaving its with block.

2 min readSource-linked guide
Developer tools · GUIDE

ConfigParser Lowercases Keys: Set the Name Transformation Before Reading

Mixed-case INI option names are lowercased when written back.

2 min readSource-linked guide
Developer tools · GUIDE

ConfigParser Rejects a Percent Sign: Choose Literal or Interpolated Values

An INI value containing a percent sign fails when retrieved or assigned.

2 min readSource-linked guide
Developer tools · GUIDE

Python BasicConfig Appears Ignored: Inspect Existing Root Handlers

A later basicConfig call does not apply the expected level or format.

2 min readSource-linked guide
Developer tools · GUIDE

Python List Becomes None After Sort: Separate Mutation From the Return Value

Assigning the result of list.sort loses the list reference.

2 min readSource-linked guide
Developer tools · GUIDE

Python Tuple += Raises but the Inner List Changes: Inspect Partial Mutation

A tuple item augmented assignment raises TypeError after changing its contained list.

2 min readSource-linked guide
Developer tools · GUIDE

Python Matrix Rows Change Together: Build Each Mutable Row Separately

Assigning one cell changes several rows in a list-built matrix.

2 min readSource-linked guide
Developer tools · GUIDE

Python UnboundLocalError After Adding an Assignment: Return State Explicitly

A function can read an outer name until a local assignment changes its scope.

2 min readSource-linked guide
Developer tools · GUIDE

Python Loop Lambdas Return the Last Value: Capture Each Callback’s Input

Callbacks created in a loop return the same value when called later.

2 min readSource-linked guide
Developer tools · GUIDE

Python JSON Changes Integer Keys to Strings: Preserve IDs Without Collisions

Diagnose integer-key lookups after Python JSON round trips, reject duplicate names and choose an explicit ID schema without silently losing records.

6 min readSource-linked guide
Developer tools · GUIDE

Python Popen Timeout: Separate Running Status, Output Collection and Child Cleanup

Distinguish poll from communicate, observe a still-running child after timeout, then collect bounded output from a child your script owns.

5 min readSource-linked guide
Developer tools · GUIDE

Python ZIP Is Larger Than the Source: Check Members, Compression and Output Location

Measure ZIP member sizes and container overhead, then create a verified archive outside the input tree without promising lossless size reduction.

5 min readSource-linked guide
Developer tools · GUIDE

JSON Shows Unicode Escapes: Separate Representation, UTF-8 Bytes and Double Encoding

Round-trip escaped and literal JSON, preserve intentional backslashes, and distinguish a saved UTF-8 file from a second JSON serialization layer.

3 min readSource-linked guide
Developer tools · GUIDE

Zip Strict Checks Too Late for Your Side Effects: Understand Lazy Mismatch Detection

Compare truncation, strict iteration and explicit padding, then choose whether finite inputs must be staged before any writes begin.

3 min readSource-linked guide
Developer tools · GUIDE

Mock Patch Has No Effect: Check the Consumer’s Imported Binding

Compare direct imports and module lookups in an inert three-module fixture, then verify the mock call count and restoration.

3 min readSource-linked guide
Developer tools · GUIDE

Make_archive Puts Files in the Wrong Place: Separate Output Path and Member Root

Compare base_name, root_dir and base_dir with complete ZIP manifests before deciding where an archive is written or how its contents are prefixed.

3 min readSource-linked guide
Developer tools · GUIDE

Bash Loop Runs Once With No Matching Files: Choose Nullglob or an Error

Compare unmatched literal patterns, nullglob, failglob and quoted patterns in empty and nonempty directories before adding file writes.

3 min readSource-linked guide