from asammdf import MDF, Signal
data = MDF(r'D:\Docker\BW27\2024-04-23_12-39-24_2024-04-23_12-39-31_556495_9T56155_FRR_DEBUG_0000.MF4')
Traceback
File "D:\Docker\ARS540DP14_reprocessing_system\test.py", line 22, in
data = MDF(r'D:\Docker\BW27\2024-04-23_12-39-24_2024-04-23_12-39-31_556495_9T56155_FRR_DEBUG_0000.MF4')
File "C:\LegacyApp\Python\Python39\lib\site-packages\asammdf\mdf.py", line 350, in init
self._mdf = MDF4(name, channels=channels, **kwargs)
File "C:\LegacyApp\Python\Python39\lib\site-packages\asammdf\blocks\mdf_v4.py", line 402, in init
self._read(mapped=True, progress=progress)
File "C:\LegacyApp\Python\Python39\lib\site-packages\asammdf\blocks\mdf_v4.py", line 669, in _read
record_size=record_size,
UnboundLocalError: local variable 'record_size' referenced before assignment
Description
This is a small bug in asammdf\blocks\mdf_v4.py, we should initialize the record_size to 0 in case the MDF is reading an empty mf4 files or else we will get the error mentioned in traceback
This can be easily fixed by adding a line shown below
Python version
Please run the following snippet and write the output here
Code
('python=3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 ' 'bit (AMD64)]') 'os=Windows-10-10.0.19045-SP0' 'numpy=1.26.4'
MDF version
MDF; 4.11
Code snippet
from asammdf import MDF, Signal data = MDF(r'D:\Docker\BW27\2024-04-23_12-39-24_2024-04-23_12-39-31_556495_9T56155_FRR_DEBUG_0000.MF4')
Traceback
File "D:\Docker\ARS540DP14_reprocessing_system\test.py", line 22, in
data = MDF(r'D:\Docker\BW27\2024-04-23_12-39-24_2024-04-23_12-39-31_556495_9T56155_FRR_DEBUG_0000.MF4')
File "C:\LegacyApp\Python\Python39\lib\site-packages\asammdf\mdf.py", line 350, in init
self._mdf = MDF4(name, channels=channels, **kwargs)
File "C:\LegacyApp\Python\Python39\lib\site-packages\asammdf\blocks\mdf_v4.py", line 402, in init
self._read(mapped=True, progress=progress)
File "C:\LegacyApp\Python\Python39\lib\site-packages\asammdf\blocks\mdf_v4.py", line 669, in _read
record_size=record_size,
UnboundLocalError: local variable 'record_size' referenced before assignment
Description
This is a small bug in asammdf\blocks\mdf_v4.py, we should initialize the record_size to 0 in case the MDF is reading an empty mf4 files or else we will get the error mentioned in traceback
This can be easily fixed by adding a line shown below