Open wmcaliley-usgs opened 4 days ago
Thanks for reporting the issue! I just committed a fix. Please give it a try and let me know if this works by installing async-retriever
from Git. I will release a new version soon.
The issue is only with running this in IPython, so notebooks are not affected. It appears that IPython does not work with nest-asyncio
package. I also realized that, the maintainer of nest-asyncio
package sadly passed away, so the package is not maintained anymore.
Looks great! I tested both the MCVE that only uses async_retriever and the shorter pynhd minimal example in IPython, and both work now with your fix. I also tested the pynhd minimal example at the Python prompt, Jupyter lab, Jupyter console, and Jupyter QT console - all good. Thanks so much!
Awesome! Thanks for testing it comprehensively! I also tested on Google Colab and it worked.
What happened?
I've been trying to use
pynhd
to download HUC 8 data from IPython, but IPython crashes with the message "RuntimeError: Event loop is closed". I only experience this bug in IPython - no problem at the Python prompt, or Jupyter, or even using ipdb within IPython.What did you expect to happen?
I expected HUC 8 data to be downloaded without crashing IPython.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
Here's another minimal example that better reflects my use case. Again, it's only a problem in IPython.
I do NOT understand how
asyncio
or event loops work, but I think that IPython crashes uponloop.close()
here, meaning thatnew_loop
isTrue
. Could the problem be that a new loop is created inasync_retriever._utils.get_event_loop()
when it shouldn't be?Environment