wokwi / kicad-jlcpcb-bom-plugin

Export a JLCPCB Compatible BOM directly from your KiCad schematic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work in Kicad 6

haakonnessjoen opened this issue · comments

I get the following error:
ModuleNotFoundError: No module named 'kicad_netlist_reader'

Same.

python3 "C:\Users\xx\Documents\KiCad\6.0\scripting\plugins/bom_csv_jlcpcb.py" "D:\Data\Projects\KiCad\ESP32 PC Front Panel\ESP32 PC Front Panel.xml" "D:/Data/Projects/KiCad/ESP32 PC Front Panel/ESP32 PC Front Panel.csv" Command error. Return code 1. Traceback (most recent call last): File "C:\Users\xx\Documents\KiCad\6.0\scripting\plugins\bom_csv_jlcpcb.py", line 23, in <module> import kicad_netlist_reader ModuleNotFoundError: No module named 'kicad_netlist_reader'

I also have the error ModuleNotFoundError: No module named 'kicad_netlist_reader' when running the bom_csv_jlcpcb.

Full error:

python "C:\Users\Public\Downloads\programs\KiCad_JLCPCBPlugIn\kicad-jlcpcb-bom-plugin/bom_csv_jlcpcb.py" "C:\Users\Public\Downloads\Arduino\PubInv\general-alarm-device\Hardware\PolyVent_SPI_Controller\PolyVent_SPI_Controller.xml" "C:/Users/Public/Downloads/Arduino/PubInv/general-alarm-device/Hardware/PolyVent_SPI_Controller/PolyVent_SPI_Controller.csv"
Command error. Return code 1.
Traceback (most recent call last):
File "C:\Users\Public\Downloads\programs\KiCad_JLCPCBPlugIn\kicad-jlcpcb-bom-plugin\bom_csv_jlcpcb.py", line 23, in
import kicad_netlist_reader
ModuleNotFoundError: No module named 'kicad_netlist_reader'

I am running Windows 10.
I am running this version of KiCad 6.0.6
image

I would suspect the root cause is that we need a module 'kicad_netlist_reader'
But from where would this come?

More information.
I found the 'kicad_netlist_reader' in my KiCad folder ...KiCad\6.0\bin\scripting\plugins .
See screen shot:
image

I moved my Wikwi python scripts into this folder and had to press the button regarding administrative privileges.
I reran the script and now get a new error.

python "C:\Program Files\KiCad\6.0\bin\scripting\plugins/bom_csv_jlcpcb.py" "C:\Users\Public\Downloads\Arduino\PubInv\general-alarm-device\Hardware\PolyVent_SPI_Controller\PolyVent_SPI_Controller.xml" "C:/Users/Public/Downloads/Arduino/PubInv/general-alarm-device/Hardware/PolyVent_SPI_Controller/PolyVent_SPI_Controller.csv"
Command error. Return code 1.
Traceback (most recent call last):
File "C:\Program Files\KiCad\6.0\bin\scripting\plugins\bom_csv_jlcpcb.py", line 48, in
out.writerow([c.getValue() + " " + c.getDescription(), ",".join(refs), c.getFootprint().split(':')[1],
IndexError: list index out of range

The indexError:list index out of range requires the next investigation.

Continued...
I found that the script did make a file and it has some but not all rows necessary to cover all my component types as a BOM should. I expect 29 rows based on the BOM I get from the KiCad bom scripts that do work.

Something caused the index out of range error.
image

Of course the column "LCSC Part #" is empty because I do not have such a field in my parts (yet).

Another root cause of this not working is that the required Symbol Properties fields required were not defined byt this project. The requirements could be put for example in the README.md of this project.

commented

I had the same issue on Linux with KiCad 6 installed as a flatpak.

I solved it by adding the KiCad system installation plugin folder to the python path by adding this in the top of bom_csv_jlcpcb.py.

import sys
sys.path.append('/usr/share/kicad/plugins')

I guess one could also solve it by placing the script in /usr/share/kicad/plugins

Thank you for creating the project @urish 🙂

KiCad 7 flatpak update
For the KiCad 7 Flatpak distribution I added this to the top of the script:

import sys
sys.path.append('/app/share/kicad/plugins')