![](https://secure.gravatar.com/avatar/63504c5a7ff35b926ee87e693cf4f212.jpg?s=120&d=mm&r=g)
24 Jun
2022
24 Jun
'22
12:20 a.m.
I see one fix is to also check if `elem.getparent() is not None`. Thoughts? elem.clear() while elem.getprevious() is not None and elem.getparent() is not None: del elem.getparent()[0]