mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-12 14:40:06 +08:00
script: work around a KeyError exception in Python Wikipedia lib.
Even the test `if hasattr(page, 'links')` would trigger this exception. So I try the approach "Easier to Ask Forgiveness than Permission". Weird stuff but well… Note: I had this exception when running it on the Maltese data.
This commit is contained in:
parent
2700cf3a83
commit
26024e5c82
@ -257,7 +257,10 @@ def visit_pages(titles, depth, lang, logfd):
|
||||
logfd.write("\n{} (revision {})".format(title, page.revision_id))
|
||||
|
||||
process_text(page.content, lang)
|
||||
next_titles += page.links
|
||||
try:
|
||||
next_titles += page.links
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if depth >= options.max_depth:
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user