Reading MF4 with errors #1209
-
|
What is the intent of asammdf when it comes to handling invalid files (files where MDF Validator shows errors)? Is it expected that asammdf may throw an error, or does it attempt to read the file, despite potential corruption? Asking because I have a file with some errors (shown below), and asammdf is not able to read the file, but other tools I have tried can open it (likely with some loss of data). This is the error from asammdf when calling
Adding the following code to Add this: if addr > self.file_limit:
logger.warning(f"Data block address {addr:X} is outside the file size {self.file_limit}")
breakHere: asammdf/src/asammdf/blocks/mdf_v4.py Line 2001 in 15b1032 Is this an acceptable solution to allow recovery of a file that is broken? I recognize that this covers just one of many possible cases where the address to a block might point outside the file. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
I think it would be nice to be able to continue on errors when possible but it should be an opt-in feature (not default) gated behind an option (name examples: |
Beta Was this translation helpful? Give feedback.
-
|
@danielhrisca should I open an issue for this? Basically, I am wondering if asammdf throwing an error on this file is expected behavior, or if a change like the code I posted is worth including to try and read the file, essentially ignoring the faulty blocks? |
Beta Was this translation helpful? Give feedback.
-
|
@markwaterbury please try the development branch code from asammdf import MDF, set_global_option, get_global_option
set_global_option("raise_on_incomplete_blocks", False)
m = MDF(r'myfile.mf4') |
Beta Was this translation helpful? Give feedback.

@markwaterbury please try the development branch code