database as_dbc_string() TypeError using bitstruct.c
See original GitHub issuePython Version: 3.8.5 Cantools Version 34.2.0+ OS: Windows 10 (1909)
This works fine in cantools version 34.1.0. From the commits it appears there was a change from using bistruct to using bitstruct.c. Reverting this change in 34.2.0 does fix the issue.
Further analysis shows bitstruct was at version 8.10.0, updating to 8.11.1 can also resolve the issue.
I am no expert but I think this means that the setup.py needs to have the required bitstruct version upped?
Test code
import cantools
dbc = cantools.database.load_file("vehicle.dbc",strict=False)
cantools.database.dump_file(dbc,"vehicle2.dbc")
Error Messages
File "c:\anaconda3\envs\py38-logger-tool\lib\site-packages\cantools\database\__init__.py", line 216, in dump_file
output = database.as_dbc_string()
File "c:\anaconda3\envs\py38-logger-tool\lib\site-packages\cantools\database\can\database.py", line 279, in as_dbc_string
return dbc.dump_string(InternalDatabase(self._messages,
File "c:\anaconda3\envs\py38-logger-tool\lib\site-packages\cantools\database\can\formats\dbc.py", line 1524, in dump_string
database = deepcopy(database)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 146, in deepcopy
y = copier(x, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 146, in deepcopy
y = copier(x, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 205, in _deepcopy_list
append(deepcopy(a, memo))
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 146, in deepcopy
y = copier(x, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 146, in deepcopy
y = copier(x, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 264, in _reconstruct
y = func(*args)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 263, in <genexpr>
args = (deepcopy(arg, memo) for arg in args)
File "c:\anaconda3\envs\py38-logger-tool\lib\copy.py", line 161, in deepcopy
rv = reductor(4)
TypeError: cannot pickle 'bitstruct.c.CompiledFormatDict' object
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
bitstruct - Interpret strings as packed binary data — bitstruct ...
To use bitstruct.c , do import bitstruct.c as bitstruct . ... Bit endianness and byte order are not yet supported. byteswap() can only...
Read more >bitstruct - PyPI
This module performs conversions between Python values and C bit field structs represented as Python byte strings.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@andlaus I’ll give it a try during the weekend, so no need for you to work on it right now.
done: https://github.com/eerimoq/bitstruct/issues/24