From 3b5d3e012916d445bbe4ffc2bf888c6d0f728c30 Mon Sep 17 00:00:00 2001 From: Otto Brinkhaus Date: Thu, 13 Jul 2023 23:29:12 +0200 Subject: [PATCH] fix: only remove PIKAChU if it is there initially (caused crash) --- RanDepict/randepict.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RanDepict/randepict.py b/RanDepict/randepict.py index 58eb1a0..100b039 100644 --- a/RanDepict/randepict.py +++ b/RanDepict/randepict.py @@ -313,7 +313,8 @@ def get_depiction_functions(self, smiles: str) -> List[Callable]: # Remove PIKAChU if there is an isotope if re.search("(\[\d\d\d?[A-Z])|(\[2H\])|(\[3H\])|(D)|(T)", smiles): - depiction_functions.remove(self.pikachu_depict) + if self.pikachu_depict in depiction_functions: + depiction_functions.remove(self.pikachu_depict) if self.has_r_group(smiles): # PIKAChU only accepts \[[RXZ]\d*\] squared_bracket_content = re.findall("\[.+?\]", smiles)