Skip to content

Commit 99bb97b

Browse files
authored
eds: Fix exception in comment parsing with hexadecimal line count. (#279)
Inside an EDS file's [Comments] section, the Lines attribute may be expressed as a hexadecimal number prefixed with 0x. The ConfigParser.getint() method however does not support such a format. Switch to the default int() constructor with a base=0 argument to enable auto-detection of this condition. The same is done for basically every other numeric value in the EDS importer.
1 parent 1ea906d commit 99bb97b

File tree

1 file changed

+1
-1
lines changed
  • canopen/objectdictionary

1 file changed

+1
-1
lines changed

canopen/objectdictionary/eds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def import_eds(source, node_id):
4141
}
4242

4343
if eds.has_section("Comments"):
44-
linecount = eds.getint("Comments", "Lines")
44+
linecount = int(eds.get("Comments", "Lines"), 0)
4545
od.comments = '\n'.join([
4646
eds.get("Comments", "Line%i" % line)
4747
for line in range(1, linecount+1)

0 commit comments

Comments
 (0)