From 2b8d98e3d6df59379b0da52902052c61f199ecac Mon Sep 17 00:00:00 2001 From: cloveranon Date: Sat, 21 Dec 2019 00:49:44 -0500 Subject: [PATCH] Catch pastebin download errors. --- play.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/play.py b/play.py index 456939c..594d1b1 100644 --- a/play.py +++ b/play.py @@ -28,8 +28,6 @@ colors=config["Colors"] os.environ["TF_CPP_MIN_LOG_LEVEL"] = settings["log-level"] -if not Path('prompts', 'Anime').exists(): - import pastebin #ECMA-48 set graphics codes for the curious. Check out "man console_codes" def colPrint(str, col='0', wrap=True): @@ -77,6 +75,11 @@ def getGenerator(): top_k=settings.getint("top-keks"), top_p=settings.getfloat("top-p")) +if not Path('prompts', 'Anime').exists(): + try: + import pastebin + except: + colPrint("Failed to scrape pastebin, possible connection issue.\nTry again later. Continuing without downloading prompts...", colors['error']) def play(): story_manager = UnconstrainedStoryManager(getGenerator())