Skip to content
All library documents

Basic Python Debugging: Syntax, Indentation, Arguments, and Tracebacks

Article Quant course library

Summary

This brief guide introduces several common Python errors and ways to begin diagnosing them. It illustrates how visually similar full-width punctuation can trigger a syntax error, how inconsistent indentation can raise an indentation error, and how a function call with a required argument missing can fail. A missing package is shown as an import error.

For locating the source of an exception, the guide points readers to the traceback and its function call stack. It also suggests searching error messages online, including translating them when useful. These are introductory troubleshooting cues rather than a complete debugging workflow: it does not cover interactive debuggers, systematic reproduction, or verification of fixes, and includes no trading-specific examples.

Key ideas

  • Full-width punctuation can cause syntax errors even when it resembles ordinary Python punctuation.
  • Inconsistent indentation can prevent a program from running.
  • Function calls must provide required arguments correctly.
  • Tracebacks help locate the call path leading to an exception.
  • Online searches can help interpret unfamiliar errors, though the guide gives no systematic verification process.

Tags

From a private course collection; the original is not published.