From ba8ee3a6be4049c2bccc03976b7396d7e11b89ca Mon Sep 17 00:00:00 2001 From: Alasdair Date: Thu, 5 Sep 2013 12:03:51 +0200 Subject: catch disambiguation errors and display the 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