iSponsorBlockTV icon indicating copy to clipboard operation
iSponsorBlockTV copied to clipboard

aiohttp 3.10+ compatibility

Open gepbird opened this issue 9 months ago • 6 comments

Before opening an issue make sure that there are no duplicates and that you are on the latest version. Describe the bug When using aiohttp 3.10+, I get this error when running this app: RuntimeError: no running event loop.

To Reproduce Steps to reproduce the behavior:

  1. Update aiohttp to 3.11.11
  2. Run iSponsorBlockTV setup-cli
  3. See error

Expected behavior No error

Screenshots

 ❯ iSponsorBlockTV setup-cli
Could not load config file
Blank config file created
Welcome to the iSponsorBlockTV cli setup wizard
Traceback (most recent call last):
  File "/nix/store/gh6q9s7nlbz2128p6pa6aycrsqlcxmx3-iSponsorBlockTV-2.2.1/bin/.iSponsorBlockTV-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/gh6q9s7nlbz2128p6pa6aycrsqlcxmx3-iSponsorBlockTV-2.2.1/lib/python3.12/site-packages/iSponsorBlockTV/__main__.py", line 5, in main
    helpers.app_start()
  File "/nix/store/gh6q9s7nlbz2128p6pa6aycrsqlcxmx3-iSponsorBlockTV-2.2.1/lib/python3.12/site-packages/iSponsorBlockTV/helpers.py", line 218, in app_start
    cli(obj={})
  File "/nix/store/1xajkynqwbk8bdlj8d84wypqivmnkh7g-python3.12-rich-click-1.8.5/lib/python3.12/site-packages/rich_click/rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1dx2z4h3yddb2s0flwyl5l64l4g3h9lj-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1xajkynqwbk8bdlj8d84wypqivmnkh7g-python3.12-rich-click-1.8.5/lib/python3.12/site-packages/rich_click/rich_command.py", line 152, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/nix/store/1dx2z4h3yddb2s0flwyl5l64l4g3h9lj-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1dx2z4h3yddb2s0flwyl5l64l4g3h9lj-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1dx2z4h3yddb2s0flwyl5l64l4g3h9lj-python3.12-click-8.1.7/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1dx2z4h3yddb2s0flwyl5l64l4g3h9lj-python3.12-click-8.1.7/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/gh6q9s7nlbz2128p6pa6aycrsqlcxmx3-iSponsorBlockTV-2.2.1/lib/python3.12/site-packages/iSponsorBlockTV/helpers.py", line 182, in setup_cli
    config_setup.main(config, ctx.obj["debug"])
  File "/nix/store/gh6q9s7nlbz2128p6pa6aycrsqlcxmx3-iSponsorBlockTV-2.2.1/lib/python3.12/site-packages/iSponsorBlockTV/config_setup.py", line 74, in main
    web_session = aiohttp.ClientSession()
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/c4v4aq01pjxw5cqc5brklvjbf0qw1w5i-python3.12-aiohttp-3.11.11/lib/python3.12/site-packages/aiohttp/client.py", line 310, in __init__
    loop = loop or asyncio.get_running_loop()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop

iSponsorBlockTV server (please complete the following information):

  • OS: NixOS 24.11 x64
  • Python version: 3.12.8

Additional context Upstream issue: https://github.com/aio-libs/aiohttp/issues/8555

Open PRs (needs manual fixing):

  • https://github.com/dmunozv04/iSponsorBlockTV/pull/239
  • https://github.com/dmunozv04/iSponsorBlockTV/pull/226

We notice this in nixpkgs (https://github.com/NixOS/nixpkgs/issues/370525) where we try to use the latest dependencies.

gepbird avatar Feb 11 '25 13:02 gepbird

Hi there, thanks for opening an issue. This package currently supports aiohttp==3.9.5 since newer versions haven’t been checked to work correctly. I don’t know if you’re able to pin a dependency to an older version on nix. When I have time, I’ll update the dependencies and perform the required fixes to make new versions work

dmunozv04 avatar Feb 11 '25 13:02 dmunozv04

We'll have to wait until https://github.com/FabioGNR/pyytlounge/pull/11 gets merged, since it also has the same issue

dmunozv04 avatar Feb 12 '25 10:02 dmunozv04

https://github.com/FabioGNR/pyytlounge/pull/11 is now merged but make sure to take a look at my comment on PR https://github.com/dmunozv04/iSponsorBlockTV/pull/241 as the fix for Issue https://github.com/dmunozv04/iSponsorBlockTV/issues/233 will cause an issue if you just pull the latest version in.

bertybuttface avatar Feb 14 '25 17:02 bertybuttface

Thanks for your quick responses and reaching out to upstream! IIUC currently it should work on this repo's main (1914afa4326be80587fdc081464e764c2fbc7872) with aiohttp 3.10+ without using https://github.com/FabioGNR/pyytlounge/pull/11, so staying on pyytlounge version 2.1.1? That doesn't seem to be the case, I still get RuntimeError: no running event loop. I'm not in a hurry about this, take your time to update to the new pyytlounge version :)

gepbird avatar Feb 14 '25 18:02 gepbird

It's now working on the develop/main branch. If it all goes well, I'll make a release in a couple of days. Thanks @bertybuttface for updating pyytlounge

dmunozv04 avatar Feb 18 '25 23:02 dmunozv04

I'm using a patched version of this with the latest pyytlounge / aiohttp:

https://github.com/bertybuttface/addons/blob/ca32e05d2f9f6ec3a904f6e99c75b24a34fd1f69/isponsorblocktv/Dockerfile#L10

This is the patch I applied to https://github.com/dmunozv04/iSponsorBlockTV/commit/1914afa4326be80587fdc081464e764c2fbc7872 before building:

RUN git clone https://github.com/dmunozv04/iSponsorBlockTV /repo
# START PATCH (remove patch once isponsorblock is updated to aiohttp 3.11.12)
RUN sed -i 's/aiohttp==3.9.5/aiohttp==3.11.12/g' /repo/requirements.txt && \
    sed -i 's/pyytlounge==2.1.1/pyytlounge==2.1.2/g' /repo/requirements.txt
RUN cd /repo && git config user.email "none" && git config user.name "none" && \
    git revert ae6da834e492554d40c279fadff7cfa00b70ac0e && cd ..
# END PATCH

I will remove that patch and pull the latest once it's merged but no rush.

Other than the change to async for main and reverting: https://github.com/dmunozv04/iSponsorBlockTV/issues/233 it is the same and has been pulled 366 times already so I'd probably have heard by now if there were any major problems. Works fine for me too.

bertybuttface avatar Feb 18 '25 23:02 bertybuttface

This should be done now with the v2.3.0 release

dmunozv04 avatar Feb 21 '25 11:02 dmunozv04