From ecfcc3963a5c339ddec4128ea37b0f4175ed3dc6 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Wed, 9 Dec 2015 17:24:00 +0000 Subject: Catch exception and print message when no results are found --- wikiquery | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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:] -- cgit v1.2.3