delphiki / AirStatus

Check AirPods battery levels on Linux
GNU General Public License v3.0
135 stars 23 forks source link

Getting RuntimeError: Event loop is closed #13

Closed Thinura660 closed 1 year ago

Thinura660 commented 2 years ago

[root@archlinux lib]# python3 airstatus.py /usr/lib/airstatus.py:59: DeprecationWarning: There is no current event loop loop = get_event_loop() Traceback (most recent call last): File "/usr/lib/airstatus.py", line 147, in run() File "/usr/lib/airstatus.py", line 132, in run data = get_data() File "/usr/lib/airstatus.py", line 68, in get_data raw = get_data_hex() File "/usr/lib/airstatus.py", line 60, in get_data_hex a = loop.run_until_complete(get_device()) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/usr/lib/airstatus.py", line 43, in get_device devices = await discover() File "/usr/lib/python3.10/site-packages/bleak/backends/scanner.py", line 116, in discover async with cls(*kwargs) as scanner: File "/usr/lib/python3.10/site-packages/bleak/backends/scanner.py", line 96, in aenter await self.start() File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/scanner.py", line 137, in start self._stop = await manager.active_scan( File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 384, in active_scan reply = await self._bus.call( File "/usr/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 303, in call self._call(msg, reply_handler) File "/usr/lib/python3.10/site-packages/dbus_next/message_bus.py", line 588, in _call self.send(msg) File "/usr/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 326, in send self._writer.schedule_write(msg, future) File "/usr/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 85, in schedule_write self.loop.add_writer(self.fd, self.write_callback) File "/usr/lib/python3.10/asyncio/selector_events.py", line 341, in add_writer self._add_writer(fd, callback, args) File "/usr/lib/python3.10/asyncio/selector_events.py", line 290, in _add_writer 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

jakobstoeckl commented 2 years ago

I have the same issue 2

mrsteve0924 commented 1 year ago

i updated python-dbus-fast to version 1.75 from 1.14 and it seems to work now

ssergiienko commented 1 year ago

Just want to confirm that everything works without any issues with AirPods2 Pro and this version of packages

community/python-async-timeout  4.0.2-1
community/python-bleak          0.19.5-1
community/python-dbus-fast      1.84.2-1
extra/python-pyasn1             0.4.8-7
extra/python-pyasn1-modules     0.2.8-6
extra/python-service-identity   21.1.0-4
mrsteve0924 commented 1 year ago

there was a pull request to address airpods2 pro, but it doesnt look like it was merged. https://github.com/delphiki/AirStatus/pull/16

but otherwise this works for me with my airpods2 with these versions of python packages you listed. but there are others who still report they have issues getting it to work.