Open patquem opened 2 years ago
I think this could be a bug in nbclient: https://github.com/jupyter/nbclient/issues/249
A workaround for your case would be to ensure there is an asyncio
loop so nbclient's bits and pieces don't need to create one for every .preprocess
invocation.
Thank you @akx for your comment and the issue you opened in jupyter/nbclient. I don't know how to handle the asyncio loop properly in practice, but my (dirty) idea is presently just to close the BaseEventLoop object (in asyncio/base_events.py) before warnings message management, like so:
def __del__(self):
self.close() # ADDED LINE
if not self.is_closed():
warnings.warn(f"unclosed event loop {self!r}", ResourceWarning,
source=self)
if not self.is_running():
self.close()
Hi,
When executing a nbconvert.ExecutePreprocessor() outside a unittest, all works perfectly. But when launching the same function embeded in a unittest class (to execute as a unittest), the following message appears:
... with sometimes, a python crash :(
python kernel: 3.7.7 virtual env created simply with just >> pip install notebook Imported nbconvert version: 7.0.0
To reproduce the problems:
Any idea to fix this and then, to avoid hundreds of ResourceWarning messages in a big test suite ? Thanks.
Patrick
NB : note that creating the virtual env just passing by >> pip install nbconvert engenders problem related to kernel-name='python3' during the execution of the previous script - maybe another bug to report ?