summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Colley <ac@dneg.com>2013-09-05 11:04:42 +0100
committerAlasdair Colley <ac@dneg.com>2013-09-05 11:04:42 +0100
commit990b915959821cfaa1851e3f497708fd3cbf4f87 (patch)
tree381d7ffb1d07174e121f1923bea03e195dd10af7
parent521a71199b7c2a517e4f495d38e3b2b55bf4ad41 (diff)
catch disambiguation errors and display possible options
-rwxr-xr-xwikiquery5
1 files changed, 4 insertions, 1 deletions
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()