Python Debugging Cheat Sheet/Inspect environment variables

Print environment values affecting program behavior.

Section: Runtime Inspection

Inspect environment variables

python
python
import os

print(os.environ.get("APP_ENV"))

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Runtime Inspection
Inspect object type and attributes
Quickly see what an object is and what it exposes.
OpenIn sheetpythonsame section
Inspect an object's __dict__
Show instance attributes stored on an object.
OpenIn sheetpythonsame section
Pretty print nested data
Display dicts and lists more readably.
OpenIn sheetpythonsame section
Inspect a callable signature
See function parameters at runtime.
OpenIn sheetpythonsame section
Print source code for a function
Display source when available.
OpenIn sheetpythonsame section
Show import search path
Debug why imports resolve incorrectly.
OpenIn sheetpythonsame section