devbisme / kinparse

A Parser for KiCad EESCHEMA netlists.
MIT License
23 stars 11 forks source link

No longer works with KiCAD 8 netlists #17

Closed stonedDiscord closed 2 months ago

stonedDiscord commented 2 months ago

Up until KiCAD 7.0.10 it works fine. With KiCAD 8.0.0 it no longer does. I can't find exactly what changed to make it fail.

Stack trace:

Python 3.12.5 (main, Aug  9 2024, 08:20:41) [GCC 14.2.1 20240805] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from kinparse import parse_netlist
>>> nlst = parse_netlist('netlisttest.net')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/stoned/netlisttest/venv/lib/python3.12/site-packages/kinparse/kinparse.py", line 186, in parse_netlist
    return parse_func(text)
           ^^^^^^^^^^^^^^^^
  File "/home/stoned/netlisttest/venv/lib/python3.12/site-packages/kinparse/kinparse.py", line 153, in _parse_netlist_kicad
    return parser.parseString(text)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stoned/netlisttest/venv/lib/python3.12/site-packages/pyparsing/util.py", line 256, in _inner
    return fn(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stoned/netlisttest/venv/lib/python3.12/site-packages/pyparsing/core.py", line 1199, in parse_string
    raise exc.with_traceback(None)
pyparsing.exceptions.ParseException: Missing one or more required elements ({Suppress:('(') Suppress:('components') [Group:({Suppress:('(') Suppress:('comp') {{Suppress:('(') Suppress:('ref') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} & {Suppress:('(') Suppress:('value') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} & [Suppress:('(') Suppress:('datasheet') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')] & [Suppress:('(') Suppress:('fields') [Group:({Suppress:('(') Suppress:('field') {{{Suppress:('(') Suppress:('name') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} | {Suppress:('(') Suppress:('names') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')}} & [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)]} Suppress:(')')})]... Suppress:(')')] & [Suppress:('(') Suppress:('libsource') {{Suppress:('(') Suppress:('lib') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} & {Suppress:('(') Suppress:('part') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} & [Suppress:('(') Suppress:('description') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')]} Suppress:(')')] & [Suppress:('(') Suppress:('footprint') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')] & [Group:({Suppress:('(') Suppress:('sheetpath') {{{Suppress:('(') Suppress:('name') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} | {Suppress:('(') Suppress:('names') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')}} & {{Suppress:('(') Suppress:('tstamp') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} | {Suppress:('(') Suppress:('tstamps') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')}}} Suppress:(')')})] & [Suppress:('(') Suppress:('tstamp') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} | {Suppress:('(') Suppress:('tstamps') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')] & [{Group:({Suppress:('(') Suppress:('property') {{{Suppress:('(') Suppress:('name') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} | {Suppress:('(') Suppress:('names') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')}} & [Suppress:('(') Suppress:('value') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')]} Suppress:(')')})}...]} Suppress:(')')})]... Suppress:(')')}, {Suppress:('(') Suppress:('nets') [{Suppress:('(') Suppress:('net') Group:({{Suppress:('(') Suppress:('code') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} & {{Suppress:('(') Suppress:('name') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} | {Suppress:('(') Suppress:('names') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')}} & Group:({{Suppress:('(') Suppress:('node') Group:({{Suppress:('(') Suppress:('ref') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} & {Suppress:('(') Suppress:('pin') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')} & [Suppress:('(') Suppress:('pinfunction') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')] & [Suppress:('(') Suppress:('pintype') [string enclosed in double quotes ^ string enclosed in single quotes} ^ {Suppress:([<SP><TAB><CR><LF>]...) !W:(()) Suppress:([<SP><TAB><CR><LF>]...)] Suppress:(')')]}) Suppress:(')')}}...)}) Suppress:(')')}]... Suppress:(')')}), found '\n'  (at char 21), (line:1, col:22)

Example netlist

netlisttest.net.txt

stonedDiscord commented 2 months ago

pretty much the same circuit in KiCAD 7

netlistest7.net.txt

stonedDiscord commented 2 months ago

New seem to be: components/comp/fields components/comp/description

that might actually be it

stonedDiscord commented 2 months ago

it is caused by components/comp/description i think i will come up with a PR

WisniewskiP commented 2 months ago

I'm having the same problem with KiCAD 8. It would be nice to have release containing this fix.