FootprintLoad does not work on Linux (Python Script)

Hello,

I am trying to design a layout solely on python. On my windows and linux machines I have kicad installed.

On windows when I execute following script on python

import pcbnew
enc_fp =  pcbnew.FootprintLoad(r"C:\Users\user\Desktop\PCB_Design\KiCad_Libs\Encoder\PEC12R-4025F-S0024.pretty", r"PEC12R-4025F-S0024")
type(enc_fp)

Output:
<class 'pcbnew.FOOTPRINT'>

However when I run the code on linux machine,

import pcbnew
enc_fp =  pcbnew.FootprintLoad(r"/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs/Encoder/PEC12R-4025F-S0024.pretty", r"PEC12R-4025F-S0024")
type(enc_fp)

Output:
<class 'NoneType'>

I am have tried setting Footprint path such as,

r"/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
r"~/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
r"~/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
r"/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"~/home/user/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"~/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"
"/Desktop/Configurable_MIDI/PCB_Design/KiCad_Libs"

This how the file system is created:

None of them seemed to return the footprint class to the variable. I can ‘cd’ into everyone of those directories without superuser. I have used ‘pwd’ bash command to get the exact directories as well. I have also tried flashing a fresh OS then installing the kicad too, result is again was the same.

Can you open that footprint through UI on linux? Maybe your installed kicad version is different there?

1 Like

Thanks for the answer,

I have found out that in kicad 7.0 python some functions use VECTOR2I functions instead wxPoint etc. In addition whilst PCB generations on python kicad 6.0 is compatible with 7.0 , even the libraries are not backwards compatible.

Downgrading machines to 6.0 solved the issue

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.