Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"RuntimeError: Event loop is closed" when using the warlog example #70

Closed
bandtank opened this issue Dec 31, 2020 · 3 comments
Closed

Comments

@bandtank
Copy link

bandtank commented Dec 31, 2020

I am using the example on this page, which mostly works other than the errors it spits out at the end. See below:

...
League War Season - No opponent info available
League War Season - No opponent info available
League War Season - No opponent info available
League War Season - No opponent info available
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001C73B34A1F0>
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001C73B34A1F0>
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001C73B34A1F0>
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

The only part of the script that has been modified is the username, password, and clan search string. What does that error mean and why is it happening? I've tried other examples as well and had similar issues.

Honestly, this python library seems to be overly complex. I don't understand why there are so many asynchronous functions either. I appreciate that it exists, but it's difficult to use.

@xelemir
Copy link

xelemir commented Sep 9, 2021

+1 same issue here

@Anubhav1603
Copy link
Contributor

Honestly, this python library seems to be overly complex. I don't understand why there are so many asynchronous functions either. I appreciate that it exists, but it's difficult to use.

Actually this library is async because async makes code non blockable which means smooth running of script,and if you are finding any difficulty in using this library feel free to join our discord community https://discord.gg/clashapi

@doluk
Copy link
Collaborator

doluk commented Jan 24, 2023

According to this aiohttp issue, this aiohttp issue and this httpx issue the problem is the underlaying SSL transport. Currently the only way to avoid this error message is to give the SSL transport time to shutdown by adding a time.sleep(0.25) or await asyncio.sleep(0.25) in coc.http.HTTPClient.close(). With that, no exception gets raised executing the sample code.

we agreed that this isn't our job to fix, so I will close this.

@doluk doluk closed this as completed Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants