File: simple_log_converter.py

package info (click to toggle)
python-can 4.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,372 kB
  • sloc: python: 25,840; makefile: 38; sh: 20
file content (25 lines) | stat: -rwxr-xr-x 473 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3

"""
Use this to convert .can/.asc files to .log files.
Can be easily adapted for all sorts of files.

Usage: python3 simple_log_convert.py sourceLog.asc targetLog.log
"""

import sys

import can


def main():
    """The transcoder"""

    with can.LogReader(sys.argv[1]) as reader:
        with can.Logger(sys.argv[2]) as writer:
            for msg in reader:
                writer.on_message_received(msg)


if __name__ == "__main__":
    main()