summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2015-12-09 17:24:00 +0000
committerJoe Robinson <joe@lc8n.com>2015-12-09 17:24:00 +0000
commitecfcc3963a5c339ddec4128ea37b0f4175ed3dc6 (patch)
treea8189fa8f58a8febc9bc2280094646f2e630782a
parent3223b604b7c573b494096a8a08b080b0adcfcd20 (diff)
Catch exception and print message when no results are found
-rwxr-xr-xwikiquery4
1 files changed, 3 insertions, 1 deletions
diff --git a/wikiquery b/wikiquery
index e9661cc..898e9c1 100755
--- a/wikiquery
+++ b/wikiquery
@@ -7,7 +7,7 @@ import wikipedia
from functools import partial
-version = "0.1.5"
+version = "0.1.7"
def stringify(o):
if isinstance(o, list):
@@ -60,6 +60,8 @@ def summary(topic, index):
print "index out of range, options are: [%s]" % stringify(e.options)
else:
display(e.options)
+ except wikipedia.exceptions.PageError as e:
+ print "No wikipedia results found for %s" %topic
def parse_args():
args = sys.argv[1:]