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 #328

Open
SimonBard opened this issue Dec 20, 2024 · 0 comments
Open

RuntimeError: Event loop is closed #328

SimonBard opened this issue Dec 20, 2024 · 0 comments

Comments

@SimonBard
Copy link

Sorry, I am not familiar with async actions in general. I tried to run this code:

import tibber.const
import tibber
import asyncio


async def start():
  tibber_connection = tibber.Tibber(tibber.const.DEMO_TOKEN, user_agent="change_this")
  await tibber_connection.update_info()
  print(tibber_connection.name)

  home = tibber_connection.get_homes()[0]
  await home.fetch_consumption_data()
  await home.update_info()
  print(home.address1)

  await home.update_price_info()
  print(home.current_price_info)

  # await tibber_connection.close_connection()

loop = asyncio.run(start())

but got this error:

python3 /home/simon/Downloads/DynamicPriceControl/lib/mytibber.py
Arya Stark
Winterfell Castle 1
{'energy': 0.4482, 'tax': 0.1983, 'total': 0.6465, 'startsAt': '2024-12-20T17:00:00.000+01:00', 'level': 'EXPENSIVE'}
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f122d3d6fe0>
Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f122d5c7e20>, 4611.088909367)])']
connector: <aiohttp.connector.TCPConnector object at 0x7f122d3d6f80>
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f122d3d7b20>
transport: <_SelectorSocketTransport closing fd=6>
Traceback (most recent call last):
 File "/usr/lib/python3.10/asyncio/selector_events.py", line 924, in write
   n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/usr/lib/python3.10/asyncio/sslproto.py", line 690, in _process_write_backlog
   self._transport.write(chunk)
 File "/usr/lib/python3.10/asyncio/selector_events.py", line 930, in write
   self._fatal_error(exc, 'Fatal write error on socket transport')
 File "/usr/lib/python3.10/asyncio/selector_events.py", line 725, in _fatal_error
   self._force_close(exc)
 File "/usr/lib/python3.10/asyncio/selector_events.py", line 737, in _force_close
   self._loop.call_soon(self._call_connection_lost, exc)
 File "/usr/lib/python3.10/asyncio/base_events.py", line 753, in call_soon
   self._check_closed()
 File "/usr/lib/python3.10/asyncio/base_events.py", line 515, in _check_closed
   raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
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

1 participant