Debug Python script execution failures by capturing full output with exit codes and verifying working directory before file operations