diff options
author | Alasdair Colley <ac@dneg.com> | 2013-09-05 11:04:42 +0100 |
---|---|---|
committer | Alasdair Colley <ac@dneg.com> | 2013-09-05 11:04:42 +0100 |
commit | 990b915959821cfaa1851e3f497708fd3cbf4f87 (patch) | |
tree | 381d7ffb1d07174e121f1923bea03e195dd10af7 | |
parent | 521a71199b7c2a517e4f495d38e3b2b55bf4ad41 (diff) |
catch disambiguation errors and display possible options
-rwxr-xr-x | wikiquery | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -47,7 +47,10 @@ def main(): page = wikipedia.page(topic) display(page.url) else: - display(wikipedia.summary(topic)) + try: + display(wikipedia.summary(topic)) + except wikipedia.exceptions.DisambiguationError as e: + display(e.options) if __name__ == "__main__": main() |