Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MF4 Reader class does not have a **kwargs argument #1609

@MattWoodhead

Description

@MattWoodhead

Describe the bug

The MF4 reader class does not include a **kwargs parameter in its init method, meaning that any bus called with additional config options (e.g. receive_own_meesages, unique_hardware_id, etc.) will fail to work with the can player script if it is called on an MF4 file. This is due to the same additional config options for the bus being used for the can reader object. for the other file types, this does not matter as a **kwargs argument absorbs the additional options without raising an exception.

To Reproduce

In a terminal:
python -m can.player -i virtual -c 0 -b 250000 --receive-own-messages=True test_CanMessage.mf4

Traceback (most recent call last):
  File "C:\Users\matth\anaconda3\envs\canbus\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\matth\anaconda3\envs\canbus\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\matth\anaconda3\envs\canbus\lib\site-packages\can\player.py", line 111, in <module>
    main()
  File "C:\Users\matth\anaconda3\envs\canbus\lib\site-packages\can\player.py", line 89, in main
    with LogReader(results.infile, **additional_config) as reader:
  File "C:\Users\matth\anaconda3\envs\canbus\lib\site-packages\can\io\player.py", line 99, in __new__
    return ReaderType(file=file_or_filename, **kwargs)
TypeError: MF4Reader.__init__() got an unexpected keyword argument 'receive_own_messages'

Expected behavior

MF4 files should be possible to use with the player script and interfaces with additional configuration options

Additional context

OS and version: Windows 10 21H2
Python version: 3.10.9
python-can version: 4.2.1
python-can interface/s (if applicable): ixxat

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions