diff options
author | Joe Robinson <joe@lc8n.com> | 2015-12-09 17:24:00 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2015-12-09 17:24:00 +0000 |
commit | ecfcc3963a5c339ddec4128ea37b0f4175ed3dc6 (patch) | |
tree | a8189fa8f58a8febc9bc2280094646f2e630782a | |
parent | 3223b604b7c573b494096a8a08b080b0adcfcd20 (diff) |
Catch exception and print message when no results are found
-rwxr-xr-x | wikiquery | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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:] |