From 8e5b7a935dfeead3aa8f443eb0c4e968ad69069c Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 2 Jan 2023 21:01:28 +0100 Subject: [PATCH] Fix for path at background.py and added TikTok error message just in case --- TTS/TikTok.py | 6 +++++- video_creation/background.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/TTS/TikTok.py b/TTS/TikTok.py index 543568f..b370455 100644 --- a/TTS/TikTok.py +++ b/TTS/TikTok.py @@ -108,7 +108,11 @@ class TikTok: raise TikTokTTSException(status_code, data["message"]) # decode data from base64 to binary - raw_voices = data["data"]["v_str"] + try: + raw_voices = data["data"]["v_str"] + except: + print("The TikTok TTS returned an invalid response. Please try again later, and report this bug.") + raise TikTokTTSException(0, "Invalid response") decoded_voices = base64.b64decode(raw_voices) # write voices to specified filepath diff --git a/video_creation/background.py b/video_creation/background.py index 0405e66..0458ce6 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -13,7 +13,7 @@ from utils import settings from utils.console import print_step, print_substep # Load background videos -with open("utils/backgrounds.json") as json_file: +with open("./utils/backgrounds.json") as json_file: background_options = json.load(json_file) # Remove "__comment" from backgrounds