From 39ba27422ab33e104d0f034df1e62848a5229c48 Mon Sep 17 00:00:00 2001 From: Suyash458 Date: Sun, 15 Jul 2018 18:28:06 +0530 Subject: [PATCH] Fix: Don't break if content in default language doesn't exist --- WikiParse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WikiParse.py b/WikiParse.py index 7d7a319..6d2f688 100644 --- a/WikiParse.py +++ b/WikiParse.py @@ -16,7 +16,7 @@ RELATIONS = [ "synonyms", "antonyms", "hypernyms", "hyponyms", "meronyms", "holonyms", "troponyms", "related terms", - "derived terms", "coordinate terms", + "coordinate terms", ] UNWANTED_LIST = [ @@ -74,11 +74,11 @@ def get_word_data(self, language): contents = self.soup.find_all('span', {'class': 'toctext'}) language_contents = [] start_index = None - if not start_index: - return [] for content in contents: if content.text.lower() == language: start_index = content.find_previous().text + '.' + if len(contents) != 0 and not start_index: + return [] for content in contents: index = content.find_previous().text if index.startswith(start_index):