scripts/evals: create recording subdirectories when saving audio

Example files can live under subdirectories (e.g. foundational/01.py),
so the recording path needs its parent directory created before the
audio file is written.
This commit is contained in:
Aleix Conchillo Flaqué
2026-04-10 13:19:20 -07:00
parent b1204cc430
commit 153814ecc2

View File

@@ -171,6 +171,7 @@ class EvalRunner:
async def save_audio(self, name: str, audio: bytes, sample_rate: int, num_channels: int):
if len(audio) > 0:
filename = self._recording_file_name(name)
os.makedirs(os.path.dirname(filename), exist_ok=True)
logger.debug(f"Saving {name} audio to {filename}")
with io.BytesIO() as buffer:
with wave.open(buffer, "wb") as wf: