From b4594990cbefb8ddcb3f8409d564cf3b03b6f99d Mon Sep 17 00:00:00 2001 From: Karl Voit Date: Wed, 21 Feb 2018 13:12:41 +0100 Subject: [PATCH] catching Unicode error for tag separator on Windows and using a pipe character as fallback instead --- filetags/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) mode change 100755 => 100644 filetags/__init__.py diff --git a/filetags/__init__.py b/filetags/__init__.py old mode 100755 new mode 100644 index c596aef..0637abd --- a/filetags/__init__.py +++ b/filetags/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -PROG_VERSION = "Time-stamp: <2018-01-26 19:06:46 vk>" +PROG_VERSION = "Time-stamp: <2018-02-21 13:10:36 karl.voit>" # TODO: # - fix parts marked with «FIXXME» @@ -1209,7 +1209,12 @@ def print_tag_shortcut_with_numbers(tag_list, tags_get_added=True, tags_get_link for tag in tag_list: list_of_tag_hints.append(tag + ' (' + str(count) + ')') count += 1 - print(' ' + ' ⋅ '.join(list_of_tag_hints)) + try: + print(' ' + ' ⋅ '.join(list_of_tag_hints)) + except UnicodeEncodeError: + logging.debug('ERROR: I got an UnicodeEncodeError when displaying "⋅" (or list_of_tag_hints) ' + + 'but I re-try with "|" as a separator instead ...') + print(' ' + ' | '.join(list_of_tag_hints)) print('') # newline at end