Skip to content

fix(python): harden write_file empty payloads and PFM handles - #9796

Open
Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-write-file-pfm-20260721
Open

Bartok (Bartok9) wants to merge 1 commit into
microsoft:mainfrom
Bartok9:aerial/python-write-file-pfm-20260721

Conversation

@Bartok9

@Bartok9 Bartok (Bartok9) commented Jul 21, 2026 •

Copy link
Copy Markdown

Summary

write_file is used by almost every image sample. When simGetImage returns empty/None/\0, callers could create bad files or throw TypeError.

  • No-op empty/None payloads
  • Create parent directories before write
  • Use with open for read_pfm / write_pfm so handles always close

Motivation

Empty camera responses should not break sample scripts mid-save.

Verification

  • Local checks: None/empty skip, bytes write, PFM round-trip shape/value
  • Single-file change under PythonClient/airsim/utils.py (orthogonal to the frombuffer helper PR)
  • AI-assisted; human-reviewed. Human author only.

Claim: bartok
Operator: bartok
Campaign: aerial-drone

Skip writing when image payload is None/empty (simGetImage empty path),
create parent dirs as needed, and use context managers for read_pfm/write_pfm
so handles close on errors.
@Bartok9
Bartok (Bartok9) force-pushed the aerial/python-write-file-pfm-20260721 branch from 032b89b to 2e624f8 Compare October 25, 2026 21:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant