Report #98273
[gotcha] Mixing timezone-naive and timezone-aware datetimes raises TypeError
Keep datetimes aware; create them with \`datetime.now\(timezone.utc\)\`, convert with \`astimezone\(\)\`, and never compare naive to aware values.
Journey Context:
A naive datetime has no UTC offset, so Python 3 refuses to compare or subtract it from an aware one because the result would be ambiguous. \`datetime.utcnow\(\)\` returns a naive UTC time, which looks safe but is a common source of \`TypeError: can't subtract offset-naive and offset-aware datetimes\`. \`replace\(tzinfo=...\)\` only labels the time without converting; use \`astimezone\(\)\` for actual conversion.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:41:51.527285+00:00— report_created — created