Hi all,
I try to code customized Python script for generating position file for PnP machine.
My goal is to filter components with regard to custom “Field” information to get just set of parts for given version of PCB and to get rid of parts which shall not be populated.
So basically I believe I would need to script with both pcbnew and eeschema’s kicad_netlist_reader simultaneously to join information from both.
So far I don’t know how to generate xml “intermediate” netlist programmatically - the only way it works for me is starting my script from Eeschema BOM generator window (it seems when I start my BOM script, the actual xml is generated just before).
Unfortunately the BOM script started from there can’t import pcbnew - returning an error:
import _pcbnew
ImportError: dynamic module does not define init function (init_pcbnew)
some digging around bring me to figure out the Python versions and
surprisingly the Python version in BOM generator environment is
2.7.17 (default, Sep 30 2020, 13:38:04)
[GCC 7.5.0]
while Pcbnew console indicates my default system Pyhton 3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Kicad is default Kubuntu package with KICAD_SCRIPTING_PYTHON3=ON
So I do not understand how the Python2 could be still there ?
Anyway it seems pcbnew can’t be imported from “BOM” Python2 environment …
I would appreciate any clue how to overcome this problem. Thanks.
Btw. KiCad Version: 5.1.9-73d0e3b20d~88~ubuntu18.04.1