我有一个.blf文件,我必须将它转换成一个.asc文件,以便我的ASCREADER能够读取数据。
from can.io.blf import BLFReader
blf_file = "/home/ranjeet/Downloads/CAN/BLF_Files/input.blf"
with BLFReader(blf_file) as can_log:
for msg in can_log:
print(msg)我已经试过这个了。能够读取BLF文件,需要根据.asc文件写入数据
发布于 2022-01-18 20:58:36
与我的other answer非常相似,您应该以二进制模式读取blf文件,然后在asc 1中写入消息:
import can
with open(blf_file, 'rb') as f_in:
log_in = can.io.BLFReader(f_in)
with open("file_out.asc", 'w') as f_out:
log_out = can.io.ASCWriter(f_out)
for msg in log_in:
log_out.on_message_received(msg)
log_out.stop()https://stackoverflow.com/questions/70757009
复制相似问题