From 990b915959821cfaa1851e3f497708fd3cbf4f87 Mon Sep 17 00:00:00 2001 From: Alasdair Colley Date: Thu, 5 Sep 2013 11:04:42 +0100 Subject: catch disambiguation errors and display possible options --- wikiquery | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wikiquery b/wikiquery index edf47cc..7682d78 100755 --- a/wikiquery +++ b/wikiquery @@ -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() -- cgit v1.2.3