Exception on log_files.download_log_file()

Hello everyone,

I’m having an exception “LogFilesError: FILE_OPEN_FAILED: ‘File Open Failed’; origin: download_log_file();” when downloading the log files from PX4, running the code below.

I’m using MAVSDK v0.18.0, I’d appreciate any help!

# [...] connect to the drone

await drone.action.arm()
await drone.action.disarm()

logs_dir = 'logs'
os.makedirs(logs_dir, exist_ok=True)

for entry in await drone.log_files.get_entries():
    async for progress in drone.log_files.download_log_file(entry, os.path.join(logs_dir, 'test.ulog')):
        print(progress)

The log file would get overwritten if there are multiple entries, which is intentional for this test code. There is a single log entry, copied below. The progress sometimes does goes all the way to 100%, but in any case the same exception is thrown and the log file never gets written. I’ve also tried using an absolute path, and different paths, for the log file destination just in case this is a permission issue, but resulted in the same error.

Entry: [id: 0, date: 2021-06-27T01:35:53Z, size_bytes: 479921]