我正在使用asammdf软件包来加载MDF文件。 下面的代码仅适用于我的一些 MDF 文件。 许多文件给我以下错误。 我能够在CANape中打开文件,没有问题。
在桌面应用程序中加载文件(这有效(
from asammdf import MDF
mdf = MDF(r'\Stnafddco123.us123.corpintra.netveh_testVehicles_Data_and_Truck_InfoAPTIV_logger_data1FUJHLDR8KLXXXXXX_Trip-Detail_2019-07-16 15-18-25.mf4')
mdf
error Traceback (most recent call last)
<ipython-input-16-c9001bcab2a9> in <module>()
1 from asammdf import MDF
----> 2 mdf = MDF(r'\Stnafddco123.us123.corpintra.netveh_testVehicles_Data_and_Truck_InfoAPTIV_logger_data1FUJHLDR8KLXXXXXX_Trip-Detail_2019-07-16 15-18-25.mf4')
3 mdf
~AppDataLocalContinuumanaconda3libsite-packagesasammdfmdf.py in __init__(self, name, version, **kwargs)
124 self._mdf = MDF3(name, **kwargs)
125 elif version in MDF4_VERSIONS:
--> 126 self._mdf = MDF4(name, **kwargs)
127 elif version in MDF2_VERSIONS:
128 self._mdf = MDF2(name, **kwargs)
~AppDataLocalContinuumanaconda3libsite-packagesasammdfblocksmdf_v4.py in __init__(self, name, version, **kwargs)
247 self._file = mmap.mmap(x.fileno(), 0, access=mmap.ACCESS_READ)
248 self._from_filelike = False
--> 249 self._read(mapped=True)
250
251 self._file.close()
~AppDataLocalContinuumanaconda3libsite-packagesasammdfblocksmdf_v4.py in _read(self, mapped)
415 # Read channels by walking recursively in the channel group
416 # starting from the first channel
--> 417 self._read_channels(ch_addr, grp, stream, dg_cntr, ch_cntr, mapped=mapped)
418
419 cg_addr = channel_group.next_cg_addr
~AppDataLocalContinuumanaconda3libsite-packagesasammdfblocksmdf_v4.py in _read_channels(self, ch_addr, grp, stream, dg_cntr, ch_cntr, channel_composition, mapped)
760 at_map=self._attachments_map,
761 use_display_names=self._use_display_names,
--> 762 mapped=mapped,
763 )
764
~AppDataLocalContinuumanaconda3libsite-packagesasammdfblocksv4_blocks.py in __init__(self, **kwargs)
606 conv = ChannelConversion(
607 raw_bytes=raw_bytes, stream=stream, address=address,
--> 608 mapped=mapped,
609 )
610 cc_map[raw_bytes] = conv
~AppDataLocalContinuumanaconda3libsite-packagesasammdfblocksv4_blocks.py in __init__(self, **kwargs)
2010 self.min_phy_value,
2011 self.max_phy_value,
-> 2012 ) = v4c.CONVERSION_NONE_INIT_u(block)
2013
2014 elif conv == v4c.CONVERSION_TYPE_LIN:
error: unpack requires a buffer of 56 bytes
使用 MDFValidator 打开文件时是否看到任何错误?