FIX:
pip install -r requirements.txtCHECK:
- Path correct? Use
Path(__file__).parent - File exists?
path.exists() - Permissions?
chmod 644 file
CAUSE: Function/variable is None FIX: Add guard clause
if func is None:
raise ValueError("Function not initialized")
result = func()PROFILE:
import cProfile
import pstats
profiler = cProfile.Profile()
profiler.enable()
# ... code ...
profiler.disable()
stats = pstats.Stats(profiler)
stats.sort_stats('cumulative')
stats.print_stats(20)import logging
logger = logging.getLogger(__name__)
logger.debug(f"Variable x = {x}")import pdb; pdb.set_trace()
# Commands: n (next), s (step), c (continue), p (print)# Test specific function
python -m pytest test_file.py::test_function -v