verify_email
verify_email copied to clipboard
RuntimeError: This event loop is already running
On trying to run the sample code provided, I am getting RuntimeError mentioning the loop to be running. Can anyone help?
RuntimeError Traceback (most recent call last)
F:\Anaconda3\lib\site-packages\verify_email\verify_email.py in verify_email(emails, timeout, verify, debug) 104 105 for email in emails: --> 106 resp = loop.run_until_complete(_verify_email(email, timeout, verify)) 107 result.append(resp) 108
F:\Anaconda3\lib\asyncio\base_events.py in run_until_complete(self, future) 568 future.add_done_callback(_run_until_complete_cb) 569 try: --> 570 self.run_forever() 571 except: 572 if new_task and future.done() and not future.cancelled():
F:\Anaconda3\lib\asyncio\base_events.py in run_forever(self) 523 self._check_closed() 524 if self.is_running(): --> 525 raise RuntimeError('This event loop is already running') 526 if events._get_running_loop() is not None: 527 raise RuntimeError(
RuntimeError: This event loop is already running
I was having that problem while using a Jupyter notebook.
I solved the problem by:
-
installing nest-asyncio:
pip install nest-asyncio
-
running a code cell with:
import nest_asyncio
nest_asyncio.apply()
Can you guys try the 2.4.4 version and see if it works?
pip3 install verify-email==2.4.4.dev0
check: https://github.com/kakshay21/verify_email/issues/48#issuecomment-1685262024