Closed
Description
Describe the bug
I'm a new in CANoe and I'm trying to read an asc file by ASCReader.
This asc file is automatically generated and it has a special message at the beginning: 0.000000 CANFD Start of measurement
ASCReader crashed while trying to parse this message.
asc.py crash source:
def _process_fd_can_frame(self, line: str, msg_kwargs: Dict[str, Any]) -> Message:
channel, direction, rest_of_message = line.split(None, 2)
# See ASCWriter
msg_kwargs["channel"] = int(channel) - 1
msg_kwargs["is_rx"] = direction == "Rx"
Error:
File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\can\io\asc.py", line 211, in _process_fd_can_frame
msg_kwargs["channel"] = int(channel) - 1
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Start'
To Reproduce
Prepare an asc file with 0.000000 CANFD Start of measurement
message
date Fri May 05 06:24:08.927000 PM 2024
base hex timestamps absolute
internal events logged
Begin Triggerblock Fri May 05 06:24:08.846 PM 2024
0.000000 CANFD Start of measurement
0.000000 CANFD 1 Rx 4B0 1 0 8 8 00 00 00 00 00 00 00 00 0 0 323040 0 0 0 0 0
Read this asc file by ASCReader:
import can
file_path = "example.asc"
with can.ASCReader(file_path) as log:
for message in log:
print(message)
Expected behavior
I know the format of message is not correct.
But I think the lib should ignore the wrong format message like that and continue to reader other.
I'm sorry if my thinking is wrong.
Thank you!
Additional context
OS and version:
Python version:
python-can version:
python-can interface/s (if applicable):
Traceback and logs
def func():
return "hello, world!"