deimos-deimos / comfy_api_simplified

A simple way to schedule ComfyUI prompts with different parameters
MIT License
58 stars 12 forks source link

RuntimeError: There is no current event loop in thread 'Thread-2 (process_request_thread) #4

Open zhuofengli opened 5 months ago

zhuofengli commented 5 months ago

When I run results = api.queue_and_wait_images(wf, "Save Image") It gives the following error:

File "/Users/xxx/.pyenv/versions/3.10.13/lib/python3.10/site-packages/comfy_api_simplified/comfy_api_wrapper.py", line 120, in queue_and_wait_images loop = asyncio.get_event_loop()

File "/Users/xxx/.pyenv/versions/3.10.13/lib/python3.10/asyncio/events.py", line 656, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.' RuntimeError: There is no current event loop in thread 'Thread-2 (process_request_thread)'

Any idea how to fix?

tageao460 commented 1 month ago

Try this: https://stackoverflow.com/questions/73884117/how-to-replace-asyncio-get-event-loop-to-avoid-the-deprecationwarning

Basically change asyncio.get_event_loop() to loop = asyncio.new_event_loop(); asyncio.set_event_loop(loop)