🌱 Junior Track 26 of 27
26. Debugging & Troubleshooting
Diagnose bugs efficiently by reading Python tracebacks, inspecting execution with `breakpoint()` and `pdb`, transitioning from `print()` to structured `logging`, and inspecting deep stack frames with `traceback.format_exc()`.
👁️ Views: 0
🎓 Junior Python Curriculum — Select Module
1️⃣ Fundamentals
2️⃣ Data Types
3️⃣ Operators
4️⃣ Conditionals
5️⃣ Loops
6️⃣ Collections
7️⃣ Comprehensions
8️⃣ Functions
9️⃣ *args & **kwargs
🔟 Scope & Namespaces
1️⃣1️⃣ OOP
1️⃣2️⃣ Exceptions
1️⃣3️⃣ File Handling
1️⃣4️⃣ Modules & Packages
1️⃣5️⃣ Virtual Environments
1️⃣6️⃣ Standard Library
1️⃣7️⃣ Iterators & Iterables
1️⃣8️⃣ Generators
1️⃣9️⃣ Decorators
2️⃣0️⃣ Context Managers
2️⃣1️⃣ Lambda Functions
2️⃣2️⃣ Functional Programming
2️⃣3️⃣ Type Hints
2️⃣4️⃣ Dataclasses
2️⃣5️⃣ Testing
2️⃣6️⃣ Debugging
2️⃣7️⃣ Logging
2️⃣8️⃣ JSON & Data
2️⃣9️⃣ Regular Expressions
3️⃣0️⃣ Databases
3️⃣1️⃣ APIs & HTTP
🌱 Junior Track 26 Master Reference
26. Debugging, PDB, Logging & Tracebacks Guide
🐞 Python Debugger (PDB) Essential Commands
| Command | Shortcut | Description |
|---|---|---|
| print / p | p var_name | Prints the value of an expression or variable in the current frame. |
| next | n | Executes the current line and steps over to the next line in the current function. |
| step | s | Steps inside the function call on the current line. |
| continue | c | Resumes program execution until the next breakpoint or completion. |
| where / bt | w | Displays a stack trace of all active frames leading to the current line. |
📜 Logging Levels & Severity Matrix
| Level | Numeric Value | When to Use |
|---|---|---|
| DEBUG | 10 | Detailed diagnostic information for developers during problem diagnosis. |
| INFO | 20 | Confirmation that operational workflows (requests, jobs) completed as expected. |
| WARNING | 30 | Indicates unexpected conditions or potential problems (e.g. low disk space). |
| ERROR | 40 | Serious error; software failed to execute a specific operation or request. |
| CRITICAL | 50 | Fatal failure; application or server process cannot continue running. |