Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Handle a case with no examples #99

Open
Erik-McKee opened this issue Sep 4, 2022 · 0 comments
Open

Handle a case with no examples #99

Erik-McKee opened this issue Sep 4, 2022 · 0 comments

Comments

@Erik-McKee
Copy link

The while loop here (line 200) needs an additional condition because there could be no next sibling found:

def parse_examples(self, word_contents):
    definition_id_list = self.get_id_list(word_contents, 'definitions')
    example_list = []
    for def_index, def_id, def_type in definition_id_list:
        span_tag = self.soup.find_all('span', {'id': def_id})[0]
        table = span_tag.parent
        **while table.name != 'ol':**
            table = table.find_next_sibling()

it should be:

def parse_examples(self, word_contents):
    definition_id_list = self.get_id_list(word_contents, 'definitions')
    example_list = []
    for def_index, def_id, def_type in definition_id_list:
        span_tag = self.soup.find_all('span', {'id': def_id})[0]
        table = span_tag.parent
        **while table and table.name != 'ol':**
            table = table.find_next_sibling()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant