From c2d56f2718a0712930c07e49e3981cf09944a39c Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Wed, 5 Oct 2022 18:02:47 -0700 Subject: [PATCH] restore try except --- app/cogs/actual_utils.py | 28 ++++++++++++++-------------- app/stable_diffusion.py | 1 - 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/cogs/actual_utils.py b/app/cogs/actual_utils.py index 08491c78..b93124e1 100644 --- a/app/cogs/actual_utils.py +++ b/app/cogs/actual_utils.py @@ -84,21 +84,21 @@ class ActualUtils(commands.Cog): except: ip = "192.168.1.80" - # try: - file_path = await stable_diffusion.generate_image( - ip=ip, port=port, prompt=prompt - ) - await ctx.reply( - file=discord.File( - file_path, - filename="unknown.png", + try: + file_path = await stable_diffusion.generate_image( + ip=ip, port=port, prompt=prompt + ) + await ctx.reply( + file=discord.File( + file_path, + filename="unknown.png", + ) + ) + os.remove(file_path) + except Exception as e: + await ctx.reply( + "Stable diffusion isnt running right now, sorry.\n%s" % e, ) - ) - os.remove(file_path) - # except Exception as e: - # await ctx.reply( - # "Stable diffusion isnt running right now, sorry.\n%s" % e, - # ) @commands.command(name="trackdays") async def trackdays(self, ctx: commands.Context): diff --git a/app/stable_diffusion.py b/app/stable_diffusion.py index 06d8e2d5..96e5ebe4 100644 --- a/app/stable_diffusion.py +++ b/app/stable_diffusion.py @@ -1,6 +1,5 @@ import base64 import json -import requests import httpx import socket import tempfile