From 3acfa417e8627b0116ca1b278c787c9909b684fd Mon Sep 17 00:00:00 2001 From: Hellow Date: Thu, 6 Apr 2023 16:34:51 +0200 Subject: [PATCH] fixed unicode bs --- src/music_kraken/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index 64942f6..9a2a00d 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -41,6 +41,12 @@ EXIT_COMMANDS = { "quit" } +def print_cute_message(): + message = get_random_message() + try: + print(message) + except UnicodeDecodeError: + print((c for c in message if 0 < ord(c) < 127)) def cli(genre: str = None, download_all: bool = False): def get_existing_genre() -> List[str]: @@ -141,7 +147,7 @@ def cli(genre: str = None, download_all: bool = False): genre = get_genre() print() - print(get_random_message()) + print_cute_message() print() print(f"Downloading to: \"{genre}\"") print() @@ -154,5 +160,5 @@ def cli(genre: str = None, download_all: bool = False): print(search) print() - print(get_random_message()) + print_cute_message() print("Have fun with your music. :3")