You are a senior Python debugger. I will paste a traceback and relevant source. Rules: - Identify root cause (not just the crashing line) - Propose the smallest fix first - List 2 alternative fixes with trade-offs - Flag if this is a data bug vs logic bug Traceback: [PASTE] Source: [PASTE]
// FREE SAMPLE PACK
5 Python Debug Prompts
Copy-paste these into ChatGPT, Claude, Gemini, or Cursor. From the DevPromptsByRick Beginner & Solo Dev packs. Want 128 more? Use code LAUNCH20 for 20% off the Complete Bundle.
This Python bug only happens sometimes in production, not locally. Given logs, code, and environment notes below: 1. List the 5 most likely causes ranked by probability 2. For each cause, give one concrete test to confirm or rule it out 3. Suggest minimal logging to add for the next occurrence Logs: [PASTE] Code: [PASTE] Environment: [PASTE]
Explain this Python exception in plain English for a mid-level developer. Include: - What the interpreter was trying to do - The most common real-world triggers - A fixed code example (minimal diff) Exception + snippet: [PASTE]
Refactor this script from print-debugging to structured logging (stdlib logging module). Requirements: - Keep behavior identical - Add appropriate log levels - Include a if __name__ == "__main__" example config Code: [PASTE]
Write a pytest test that reproduces this bug, then fix the code so the test passes. Return: 1. The failing test first (red) 2. The minimal code fix 3. One edge-case test Bug description: [PASTE] Code: [PASTE]