danielhrisca / asammdf

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

File loading issue in asammdf Lib, when the python script is packaged using pyinstaller #788

Closed Rachana-dot closed 10 months ago

Rachana-dot commented 1 year ago

Python version

Please run the following snippet and write the output here

import platform
import sys
from pprint import pprint

pprint("python=" + sys.version)
pprint("os=" + platform.platform())

try:
    import numpy
    pprint("numpy=" + numpy.__version__)
except ImportError:
    pass

try:
    import asammdf
    pprint("asammdf=" + asammdf.__version__)
except ImportError:
    pass

Code

ASAMMDF version : 5.20.6

Error : To change to a dtype of different size, last axis must be contiguous version : 7.1.1 ,Error : "Multiple occurrences of channel".

Code snippet

data = MDF(mf4_file) for version 5.20.6 mdf_comman_py :(line 100) : Validate channel selection - version 7.1.1

Traceback

After converting to .exe ,it says the version doesnt support ,armxl and .dbc files for version 7.1.1 : Below : arxml is not supported csv is not supported dbc is not supported dbf is not supported json is not supported ldf is not supported kcd is not supported fibex is not supported sym is not supported xls is not supported xlsx is not supported yaml is not supported scapy is not supported wireshark is not supported odx is not supported

Then throws below error : asammdf - ERROR - Error during CAN logging processing: Traceback (most recent call last): File "lib\site-packages\asammdf\blocks\mdf_v4.py", line 10480, in _process_bus_logging File "lib\site-packages\asammdf\blocks\mdf_v4.py", line 10520, in _process_can_logging File "lib\site-packages\asammdf\blocks\utils.py", line 1762, in load_can_database File "lib\site-packages\canmatrix\formats__init.py", line 52, in loads File "lib\site-packages\canmatrix\formats\init__.py", line 86, in load KeyError: 'canmatrix.formats.dbc'

Description

I am unable to load few MF4 files in the asammdf version 5.20.6 ,as it gives the error "To change to a dtype of different size, last axis must be contiguous".Then, I changed asammdf lib version to 7.1.1 ,it gives error that "Multiple occurrences of channel". I changed the above exception to False, and it worked fine in the development mode, but when converted python script to .exe using pyinstaller ,the file doesnt load.

danielhrisca commented 1 year ago

See https://github.com/danielhrisca/asammdf/issues/607#issuecomment-970009332

Rachana-dot commented 1 year ago

I did that and it worked fine when I ran the script on command prompt. But once I packaged it and ran it as an .exe, it gave me below error and also it said, it doesnt support .arxml and .dbc. arxml is not supported csv is not supported dbc is not supported Then throws below error : asammdf - ERROR - Error during CAN logging processing: Traceback (most recent call last): File "lib\site-packages\asammdf\blocks\mdf_v4.py", line 10480, in process_bus_logging File "lib\site-packages\asammdf\blocks\mdf_v4.py", line 10520, in process_can_logging File "lib\site-packages\asammdf\blocks\utils.py", line 1762, in load_can_database File "lib\site-packages\canmatrix\formats_init.py", line 52, in loads File "lib\site-packages\canmatrix\formats_init.py", line 86, in load KeyError: 'canmatrix.formats.dbc'

danielhrisca commented 1 year ago

have a look at this spec file for guidance https://github.com/danielhrisca/asammdf/blob/development/asammdf.spec

Rachana-dot commented 1 year ago

Yes, its unable to read the value of few signals when loaded but the same file works perfectly with version 5.20.6

danielhrisca commented 1 year ago

Yes, its unable to read the value of few signals when loaded but the same file works perfectly with version 5.20.6 zerorpc.ChannelMultiplexer, unable to route event: <b'\x00\x80\x00\x00)'> _zpc_hb {'v': 3, 'message_id': 'e9ce1df5-87bf-4fbe-94a9-000000000009', 'response_to': 'e9ce1df5-87bf-4fbe-94a9-000000000002'} [...] zerorpc.ChannelMultiplexer, unable to route event: <b'\x00\x80\x00\x00)'> _zpc_more {'v': 3, 'message_id': 'e9ce1df5-87bf-4fbe-94a9-00000000000a', 'response_to': 'e9ce1df5-87bf-4fbe-94a9-000000000002'} [...]

what should I understand from this?

Rachana-dot commented 1 year ago

It throws below error: asammdf - ERROR - Error during CAN logging processing: Traceback (most recent call last): File "lib\site-packages\asammdf\blocks\mdf_v4.py", line 10480, in _process_bus_logging File "lib\site-packages\asammdf\blocks\mdf_v4.py", line 10520, in _process_can_logging File "lib\site-packages\asammdf\blocks\utils.py", line 1762, in load_can_database File "lib\site-packages\canmatrix\formats__init.py", line 52, in loads File "lib\site-packages\canmatrix\formats\init__.py", line 86, in load KeyError: 'canmatrix.formats.dbc'

danielhrisca commented 1 year ago

Did you look at the spec file?

Rachana-dot commented 1 year ago

yes!! But the question is, files loads fine in the gui but not while we use the API in the python script

danielhrisca commented 1 year ago

What canmateix version is installed?

Rachana-dot commented 1 year ago

Thank you @danielhrisca ,it got resolved. Canmatrix version was 0.9.5 I built the .exe using a spec file by including all the hidden imports, it resolved the issue.

jimreb commented 1 year ago

@Rachana-dot @danielhrisca How do you managed to resolving it? Could you share the spec file for including the imports?

Thanks!

danielhrisca commented 1 year ago

@yellow3anana https://github.com/danielhrisca/asammdf/blob/180a1588737ae7aaf367aaa8fd1c81aff616df16/asammdf.spec#L37