danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
650 stars 226 forks source link

FROM_ prepended to paths causes failures when opening files #559

Closed ghost closed 2 years ago

ghost commented 3 years ago

I was using ASAMMDF 6.2.0 which was working OK, however, after I upgraded to 6.3.2 I keep getting errors regarding invalid paths because "FROM_" is being prepended to MDF, LDF paths and the like internally in the library. This is the kind of errors I get:

OSError: [Errno 22] Invalid argument: 'FROM_C:\\Proyectos\\xxxxxx\\xxxxxxx.ldf'

Is this a bug or I am missing something? asammdf 6.3.2 is unusable for me as it is right now, I had to roll back to 6.2.0.

danielhrisca commented 3 years ago

@dmgant please show the complete error traceback message

ghost commented 3 years ago

Apologies for the late reply, I was on holidays, just tried today with 6.4.0 and 6.4.4 and I get past this error, however I get a new one:

venv\lib\site-packages\___\____\____\mdf_parser\mdf_parser.py:72: in __init__
    self.__mdf = asammdf.MDF(path)
venv\lib\site-packages\asammdf\mdf.py:236: in __init__
    self._mdf = MDF4(name, channels=channels, **kwargs)
venv\lib\site-packages\asammdf\blocks\mdf_v4.py:417: in __init__
    self._read(mapped=True)
venv\lib\site-packages\asammdf\blocks\mdf_v4.py:809: in _read
    self._process_bus_logging()
venv\lib\site-packages\asammdf\blocks\mdf_v4.py:10235: in _process_bus_logging
    self._process_lin_logging(index, group)
venv\lib\site-packages\asammdf\blocks\mdf_v4.py:10498: in _process_lin_logging
    dbc = load_can_database(at_name, contents=contents)
venv\lib\site-packages\asammdf\blocks\utils.py:1532: in load_can_database
    dbs = func(arg, import_type=import_type, key="db", **kwargs)
venv\lib\site-packages\canmatrix\formats\__init__.py:77: in loadp
    return load(fileObject, import_type, key, **options)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

file_object = <_io.BufferedReader name='C:\\Proyectos\\_____\\_____\\______\\\\______\\______\\LDF\\_____.ldf'>, import_type = 'ldf', key = 'db', options = {}        
dbs = {}

    def load(file_object, import_type, key="", **options):
        # type: (typing.BinaryIO, str, str, **str) -> typing.Union[typing.Dict[str, canmatrix.CanMatrix], None]
        dbs = {}  # type: typing.Dict[str, canmatrix.CanMatrix]
>       module_instance = sys.modules["canmatrix.formats." + import_type]
E       KeyError: 'canmatrix.formats.ldf'

venv\lib\site-packages\canmatrix\formats\__init__.py:92: KeyError

The MDF file contains LIN diagnostics, not much more.

MDFValidator from Vector shows the file is fine.

danielhrisca commented 3 years ago

I think you need the latest canmatrix version. Which version do you have right now?

ghost commented 3 years ago

I am using 0.9.3, which to my understanding is the latest (release). MDF looks fine, I might look at it in detail when I have the time. I tried with 6.3.0, I get the FROM_ error with that one.

ghost commented 3 years ago

if it helps, with 6.2.0 it works fine.

danielhrisca commented 3 years ago

Same venv?

danielhrisca commented 3 years ago

0.9.3 does not contain the ldf support. They have added this after that release, so you need to install the latest master branch from canmatrix

ghost commented 3 years ago

0.9.3 does not contain the ldf support. They have added this after that release, so you need to install the latest master branch from canmatrix

Thank you, will try this asap.