diff --git a/epubfile.py b/epubfile.py index e4be293..ecaaa7b 100644 --- a/epubfile.py +++ b/epubfile.py @@ -617,11 +617,13 @@ class Epub: @writes def delete_file(self, id): manifest_item = self.opf.manifest.find('item', {'id': id}) + filepath = self.get_filepath(id) + manifest_item.extract() spine_item = self.opf.spine.find('itemref', {'idref': id}) if spine_item: spine_item.extract() - os.remove(self.get_filepath(id).absolute_path) + os.remove(filepath.absolute_path) def get_filepath(self, id): href = self.opf.manifest.find('item', {'id': id})['href']