Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Cantools trying to generate a .dbc file #597

Open
Azad202222 opened this issue Jul 24, 2023 · 7 comments
Open

Using Cantools trying to generate a .dbc file #597

Azad202222 opened this issue Jul 24, 2023 · 7 comments

Comments

@Azad202222
Copy link

Azad202222 commented Jul 24, 2023

Traceback (most recent call last):
File "D:\Python_Codes\venv\lib\site-packages\cantools\database\can\formats\dbc.py", line 1737, in try_remove_attribute
dbc.attributes.pop(name)
TypeError: set.pop() takes no arguments (1 given)

Need help in trying to solve this issue.
dump_file(db, output_file)
After calling dump_file this issue is coming
900
901
902
903
db object contains the values as shown in the pictures

@andlaus
Copy link
Member

andlaus commented Jul 24, 2023

are you sure that you use an unmodified version of cantools? your message.dbc.attributes is a set, but looking at the DBC loader code, I cannot see how this could happen. (it is supposed to be an OrderedDict.) If you do indeed use an unmodified version, can you boil down your source DBC file to something non-confidential where this still happens?

@Azad202222
Copy link
Author

image Not using unmodified version... Just installed the packages in Pycharm

@andlaus
Copy link
Member

andlaus commented Jul 24, 2023

can you provide a non-confidential version of your source DBC file that exhibits this issue?

@Azad202222
Copy link
Author

Azad202222 commented Jul 24, 2023

Im not using source DBC... Getting all the datas by importing from an excel sheet... And mapping those values to the db object... And generating a DBC file. The DBC file only not getting generated.. Throwing error

@andlaus
Copy link
Member

andlaus commented Jul 24, 2023

Im not using source DBC... Getting all the datas by importing from an excel sheet... And mapping those values to the db object... And generating a DBC file. The DBC file only not getting generated.. Throwing error

then this code is wrong: you made the message.dbc.attributes object a set, but it is supposed to be an OrderedDict...

@Azad202222
Copy link
Author

This is the error:
Traceback (most recent call last):
File "D:\Python_Codes\main.py", line 200, in
dump_file(db, output_file)
File "D:\Python_Codes\venv\lib\site-packages\cantools\database_init_.py", line 248, in dump_file
output = database.as_dbc_string(sort_signals=sort_signals)
File "D:\Python_Codes\venv\lib\site-packages\cantools\database\can\database.py", line 340, in as_dbc_string
return dbc.dump_string(InternalDatabase(self._messages,
File "D:\Python_Codes\venv\lib\site-packages\cantools\database\can\formats\dbc.py", line 1845, in dump_string
database = make_names_unique(database, shorten_long_names)
File "D:\Python_Codes\venv\lib\site-packages\cantools\database\can\formats\dbc.py", line 1816, in make_names_unique
make_node_names_unique(database, shorten_long_names)
File "D:\Python_Codes\venv\lib\site-packages\cantools\database\can\formats\dbc.py", line 1747, in make_node_names_unique
try_remove_attribute(node.dbc, 'SystemNodeLongSymbol')
File "D:\Python_Codes\venv\lib\site-packages\cantools\database\can\formats\dbc.py", line 1737, in try_remove_attribute
dbc.attributes.pop(name)
TypeError: set.pop() takes no arguments (1 given)

@Azad202222
Copy link
Author

Thanks... After converting it to OrderedDict it is working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants