Python Automation Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=5275
Answer
Troubleshoot Python automation by reading the full traceback, checking the active virtual environment and package versions (pip list), adding logging, and testing pieces in the REPL or with a debugger like pdb.
Remember
- Read the full traceback from the bottom up.
- Check the active virtual environment and versions.
- Add logging around the failing code.
First checks
python3 -X dev script.py— dev mode warningspython3 -m pdb script.py— debugpip check— dependency conflicts
Commands
python -c "import ast,pathlib; ast.parse(pathlib.Path('<script.py>').read_text())"- Read-only/validation observation for Python parser result for the selected source file without executing application lo…
Verify in this order
error → traceback → environment → fix → test
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5275