Assume there are 3 pictures with the same name. Using picture.delete(), the first/last is successfully deleted, when the program runs the second time in the loop, delete of picture fails.
Please clarify whether this behaviour is expected, if yes, it is suggested to show in the error message. It was quite confusing when receiving the error.
Same behaviour is observed with renaming using picture.name="new name". It is suspected that the object reference failed.
Code to reproduce error:
wb = xlwings.Book(path)
for sht in list(wb.sheets):
for picture in list(sht.pictures):
picture.delete()
Assume there are 3 pictures with the same name. Using picture.delete(), the first/last is successfully deleted, when the program runs the second time in the loop, delete of picture fails.
Please clarify whether this behaviour is expected, if yes, it is suggested to show in the error message. It was quite confusing when receiving the error.
Same behaviour is observed with renaming using
picture.name="new name". It is suspected that the object reference failed.Code to reproduce error: