commit 7da9bfbaffcfa3dc531dbb1fafa4dedb350dbdb3 parent dfe240bcf2db7275b35de5a807d148c5008d3243 Author: Isak Lindhé <isak.e.lindhe@gmail.com> Date: Wed, 2 Jan 2019 18:14:42 +0100 network error message Diffstat:
M | txtv.py | | | 8 | ++++++-- |
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/txtv.py b/txtv.py @@ -6,6 +6,7 @@ import colorama from colorama import Fore, Back, Style import sys import re +from util import err def get_page_number() -> int: @@ -81,11 +82,14 @@ def show_headers(): if __name__ == '__main__': colorama.init() - if sys.argv[1] == 'head': + if len(sys.argv) == 2 and sys.argv[1] == 'head': show_headers() else: page_nbr = get_page_number() - subpages = get_page(page_nbr) + try: + subpages = get_page(page_nbr) + except rq.exceptions.ConnectionError: + err('Could not connect to network :(') for page in subpages: show_page(page) colorama.deinit()