We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0c90c93 + 3a8cb10 commit 729bea8Copy full SHA for 729bea8
pydra/engine/helpers.py
@@ -648,12 +648,17 @@ def get_open_loop():
648
"""
649
if os.name == "nt":
650
loop = asyncio.ProactorEventLoop() # for subprocess' pipes on Windows
651
- asyncio.set_event_loop(loop)
652
else:
653
- loop = asyncio.get_event_loop()
654
- if loop.is_closed():
+ try:
+ loop = asyncio.get_event_loop()
+ # in case RuntimeError: There is no current event loop in thread 'MainThread'
655
+ except RuntimeError:
656
loop = asyncio.new_event_loop()
657
asyncio.set_event_loop(loop)
658
+ else:
659
+ if loop.is_closed():
660
+ loop = asyncio.new_event_loop()
661
+ asyncio.set_event_loop(loop)
662
return loop
663
664
0 commit comments