kicad-library-utils icon indicating copy to clipboard operation
kicad-library-utils copied to clipboard

schlib.py - Components don't remove successfully

Open rs-development opened this issue 5 years ago • 1 comments

I tried to create an empty library from a existing one be removing all components. I did this in a loop:

for c in lib_new.components: 
     print(lib_new.removeComponent(c.name))

But i had to run the loop multiple times to remove all components, untill no components are in the list and getComponentCount equals zero.

If the library is saved with new_lib.save() the components are still there.

Any idea whats going wrong?

rs-development avatar Nov 14 '19 22:11 rs-development

It seems to be, that the new_lib.header has to be cleared. But then the first 2 file lines are missing after saving:

EESchema-LIBRARY Version 2.4
#encoding utf-8

Those 2 lines are not generated if the header is cleared and the library is than saved. Shouldn't the schlib.py handle those things internally?

rs-development avatar Nov 14 '19 23:11 rs-development