ezzcodeezzlife / dalle2-in-python

Use DALL·E 2 in Python
https://pypi.org/project/dalle2/
MIT License
177 stars 34 forks source link

Bug #18

Closed f321x closed 2 years ago

f321x commented 2 years ago

i run a little bot with your plugin and sometimes the picture generation fails and i get this error:

2022-08-23 09:34:15,255 - telegram.ext._application - ERROR - No error handlers are registered, logging exception. Traceback (most recent call last): File "/home/satdress/.local/lib/python3.9/site-packages/telegram/ext/_application.py", line 983, in process_update await coroutine File "/home/satdress/.local/lib/python3.9/site-packages/telegram/ext/_handler.py", line 137, in handle_update return await self.callback(update, context) File "/home/satdress/dalle2telegrambot/main.py", line 62, in paid file_paths = dalle.generate_and_download(user_state[update.effective_chat.id][0]) File "/home/satdress/.local/lib/python3.9/site-packages/dalle2/dalle2.py", line 31, in generate_and_download generations = self.generate(prompt) File "/home/satdress/.local/lib/python3.9/site-packages/dalle2/dalle2.py", line 28, in generate return self.get_task_response(body) File "/home/satdress/.local/lib/python3.9/site-packages/dalle2/dalle2.py", line 77, in get_task_response data = response.json() File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Is this related to the dalle2 module not returning something or am i understanding this completely wrong?

github-actions[bot] commented 2 years ago

Thanks you for your first issue in dalle2-in-python

ezzcodeezzlife commented 2 years ago

would need more info about the project, but this probably isn't an issue from dalle2-in-python.

f321x commented 2 years ago

The project is https://github.com/exitfiat/dalle2telegrambot I think its a problem of the dalle plugin as it works since i put the generate command in try exception, or its a problem of the api itself. The error happens around 5% of all requests.

ezzcodeezzlife commented 2 years ago

will have another look at it 🔥

f321x commented 2 years ago

Cool thank you, when I look in my Dalle dashboard I see the requests have been processed but somehow your module sometimes gets an empty response and throws the traceback error iiuc. Unfortunately I'm not able to reproduce this myself. Maybe some redundancy to try to download the pictures again if the response would help this but idk