Debugging from evidence
Read tracebacks from the failing operation back to the caller, reproduce with a minimal fixture and inspect values at the suspected boundary. Python’s breakpoint starts an interactive debugger in ordinary local execution. Logging can preserve state without stopping, but sensitive data should not be emitted casually. Fix the cause and keep a regression case. A parser converting "bad" to int raises ValueError at the conversion line; inspect the field list and line number before rewriting the entire file reader or assuming a dependency installation problem caused the exception during the script’s run. Minimal reproducible inputs make hypotheses testable and reduce unnecessary changes, while retaining the failing case prevents the same defect from returning when the project is refactored, packaged or extended to accept additional input formats by a later contributor working on its code. Changing several parts of the parser before reproducing the error loses causal evidence; isolate the input, inspect actual values and test one targeted repair instead of adding broad exception handling that merely hides the failure from its current caller.
A parser converting "bad" to int raises ValueError at the conversion line; inspect the field list and line number before rewriting the entire file reader or assuming a dependency installation problem caused the exception during the script’s run.
Minimal reproducible inputs make hypotheses testable and reduce unnecessary changes, while retaining the failing case prevents the same defect from returning when the project is refactored, packaged or extended to accept additional input formats by a later contributor working on its code.
Changing several parts of the parser before reproducing the error loses causal evidence; isolate the input, inspect actual values and test one targeted repair instead of adding broad exception handling that merely hides the failure from its current caller.