KiCad 7 Python DRC problems with `lib_footprint_issues` check (incomplete initialization for this new test)
<!-- --------Before Creating a New Issue----------- * Limit report to a single issue. * Search the issue tracker to verify the issue has not already been reported. * Complete all instructions between `template comment markers <>. * Keep report contents limited to the necessary information required to fix the issue. * When creating an issue against the stable version of KiCad, make sure the latest available stable version is installed as issues may have already been resolved in later stable versions. --> # Description I have the following trivial example PCB: [t1.kicad_pcb](/uploads/bc4f6c7124e8c4b67fe31521c6cb039e/t1.kicad_pcb) Just an SMD capacitor. Running `pcbnew t1.kicad_pcb` and executing the DRC I get not errors. No need for a project or *fp-lib-table*. The **Capacitor_SMD** lib is defined in the global *fp-lib-table*, which is the default template for KiCad 7. Running the DRC using the following python code: ```python import pcbnew board = pcbnew.LoadBoard('t1.kicad_pcb') pcbnew.WriteDRCReport(board, 'report.txt', pcbnew.EDA_UNITS_MILLIMETRES, True) ``` I get: ``` [lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'. Local override; Severity: warning @(128.7500 mm, 54.7500 mm): Footprint REF** ``` This isn't the case for the GUI. This message seems to be related to the fact that there is no project file. Creating *t1.kicad_pro* almost empty: ``` { } ``` And running the python code again I get the same error. So now I removed the project and created a local *fp-lib-table*: ``` (fp_lib_table (lib (name Capacitor_SMD)(type KiCad)(uri ${KICAD7_FOOTPRINT_DIR}/Capacitor_SMD.pretty)(options "")(descr "")) ) ``` Running the script I get the same error. So now I created the silly project again. Now the error is different: ``` [lib_footprint_issues]: Footprint 'C_0603_1608Metric' not found in library 'Capacitor_SMD'. Local override; Severity: warning @(128.7500 mm, 54.7500 mm): Footprint REF** ``` This error can be fixed adding the following Python code (before pcbnew import): ```python import os os.environ['KICAD7_FOOTPRINT_DIR'] = '/usr/share/kicad/footprints' ``` From what I see: 1. You need a project, not needed when using the GUI 2. The global *fp-lib-table* is ignored 3. The KICAD7_FOOTPRINT_DIR isn't defined # KiCad Version <!-- Copy version information (from main menu Help->About KiCad ->Copy Version Info) and paste it between the triple backticks below to preserve the formatting. --> ``` Application: KiCad PCB Editor Version: 7.0.0-rc2-unknown-rc2+208+g52b07b8bac, release build Libraries: wxWidgets 3.0.5 FreeType 2.10.4 HarfBuzz 2.7.4 FontConfig 2.13.1 Platform: Debian GNU/Linux 11 (bullseye), 64 bit, Little endian, wxGTK, gnome-xorg, x11 wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24 Boost: 1.74.0 OCC: 7.5.1 Curl: 7.74.0 ngspice: 34 Compiler: GCC 10.2.1 with C++ ABI 1014 Build settings: KICAD_SPICE=ON ```
issue