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 following error
Traceback (most recent call last):
File "D:\Docker\ARS540DP14_reprocessing_system\test.py", line 3, 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
Python version
Python 3.10.0
Platform information
Windows
Numpy version
1.24.4
mdfreader version
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 following error
Traceback (most recent call last): File "D:\Docker\ARS540DP14_reprocessing_system\test.py", line 3, 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