diff --git a/tz.py b/tz.py index b03a0f7..1d71a9d 100644 --- a/tz.py +++ b/tz.py @@ -172,7 +172,12 @@ def parse_query(query): """ Parses the user query to the datetime, tz/loc parts """ - to_query = ' '.join(query).split(" to ") + query = ' '.join(query) + query = query.strip() + if not query: + logger.critical("Use a query like ['to' ]") + exit(1) + to_query = query.split(" to ") logger.debug("to_query: {}".format(to_query)) if len(to_query) == 1: # only datetime @@ -231,7 +236,7 @@ def solve_query(human_dt, human_tz_loc): def format_result(result, fmt): if result is None: - logger.critical("Could not s query") + logger.critical("Could not solve query") exit(1) logger.debug("Format: {}".format(fmt)) format_result = result.strftime(fmt)