Closed djdesant closed 6 months ago
I guest this is the precision issue of the library decimal I used to get this issue before when I tried to read string '1' and convert it into decimal.Decimal type. The result comes as decimal.Decimal('1.00000000000000000000003216...')
I guest this is the precision issue of the library decimal I used to get this issue before when I tried to read string '1' and convert it into decimal.Decimal type. The result comes as decimal.Decimal('1.00000000000000000000003216...')
Are there more possible workarounds ? @pempem98 Could you please describe your alternative proposal for solving this problem ?
I don't know a better workaround. Also - I was not able to reproduce the error.
pip install git+https://github.com/ebroecker/canmatrix.git@issue_778
I don't know a better workaround. Also - I was not able to reproduce the error.
pip install git+https://github.com/ebroecker/canmatrix.git@issue_778
Thanks for fixing.
Probably you have a clean database example without scientific numbers. I'll give you short exctract from the dbc in my case:
BA "GenMsgCycleTime" BO 2360127010 100; BA "GenMsgSendType" BO 2360127010 8.48332452797837E-317; BA "VFrameFormat" BO 2360127010 3; BA "VFrameFormat" BO 2566875426 3; BA "GenMsgCycleTime" BO 2360156846 100; BA "GenMsgSendType" BO 2360156846 8.48390950170305E-317; BA "VFrameFormat" BO 2360156846 3;
As you can see the attribute "GenMsgSendType" is marginally small number and could surely be replaced by zero, but this would require manual post-editing in an ASCII text editor after each change of the database in Vector DB Editor.
@ebroecker, when are you planning to merge the current branch into master ?
should be merged, if not please blame me
db.enum_attribs_to_values() File "C:\…\MdfMetaData.venv\Lib\site-packages\canmatrix\canmatrix.py", line 2317, in e num_attribs_to_values frame.attributes[define] = self.frame_defines[define].values[int(frame.attributes[define])] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '8.52715012702708E-317'
Please consider the casting to float before int. Example: frame.attributes[define] = self.frame_defines[define].values[int(float(frame.attributes[define]))]