schlib.py - Components don't remove successfully
rs-development opened this issue · comments
rs-development commented
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 commented
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?