ihabunek / twitch-dl

CLI tool for downloading videos from Twitch.
GNU General Public License v3.0
661 stars 84 forks source link

Error after upgrading to 2.1.4 #146

Closed KoenDG closed 6 months ago

KoenDG commented 10 months ago

Error message:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "twitch-dl.2.1.4.pyz/__main__.py", line 3, in <module>
  File "twitch-dl.2.1.4.pyz/twitchdl/console.py", line 321, in main
  File "twitch-dl.2.1.4.pyz/twitchdl/commands/download.py", line 170, in download
  File "twitch-dl.2.1.4.pyz/twitchdl/commands/download.py", line 176, in download_one
  File "twitch-dl.2.1.4.pyz/twitchdl/commands/download.py", line 316, in _download_video
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "twitch-dl.2.1.4.pyz/twitchdl/http.py", line 125, in download_all
  File "twitch-dl.2.1.4.pyz/httpx/_client.py", line 2020, in __aenter__
  File "twitch-dl.2.1.4.pyz/httpx/_transports/default.py", line 340, in __aenter__
  File "twitch-dl.2.1.4.pyz/httpcore/_async/connection_pool.py", line 331, in __aenter__
  File "twitch-dl.2.1.4.pyz/httpcore/_synchronization.py", line 64, in __aenter__
  File "twitch-dl.2.1.4.pyz/httpcore/_synchronization.py", line 56, in setup
  File "twitch-dl.2.1.4.pyz/httpcore/_synchronization.py", line 35, in current_async_library
RuntimeError: Running with asyncio requires installation of 'httpcore[asyncio]'.

I tried pip install asyncio and httpcore, didn't help.

KoenDG commented 9 months ago

Seems to be fixed after pip installed these:

    install_requires=[
        "m3u8>=1.0.0,<4.0.0",
        "httpx>=0.17.0,<1.0.0",
    ],

As mentioned in setup.py

Weird that this never happened before...

ihabunek commented 9 months ago

Strange, that should not be required if using pyz :thinking:

H-F-T commented 8 months ago

I had same exact issue, same error and traceback as posted but no luck fixing. Tried pip installing and --upgrading httpcore, asyncio, m3u8, httpx nothing helped. Then I installed and upgraded httpcore[asyncio] and after that I get new error.

Traceback (most recent call last):
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_exceptions.py", line 10, in map_exceptions
    yield
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_backends\anyio.py", line 34, in read
    return await self._stream.receive(max_bytes=max_bytes)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\anyio\streams\tls.py", line 205, in receive
    data = await self._call_sslobject_method(self._ssl_object.read, max_bytes)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\anyio\streams\tls.py", line 147, in _call_sslobject_method
    data = await self.transport_stream.receive()
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\anyio\_backends\_asyncio.py", line 1130, in receive
    raise ClosedResourceError from None
anyio.ClosedResourceError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpx\_transports\default.py", line 67, in map_httpcore_exceptions
    yield
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpx\_transports\default.py", line 252, in __aiter__
    async for part in self._httpcore_stream:
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_async\connection_pool.py", line 361, in __aiter__
    async for part in self._stream:
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_async\http11.py", line 337, in __aiter__
    raise exc
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_async\http11.py", line 329, in __aiter__
    async for chunk in self._connection._receive_response_body(**kwargs):
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_async\http11.py", line 198, in _receive_response_body
    event = await self._receive_event(timeout=timeout)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_async\http11.py", line 212, in _receive_event
    data = await self._network_stream.read(
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_backends\anyio.py", line 31, in read
    with map_exceptions(exc_map):
  File "C:\Users\stati\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ReadError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\http.py", line 106, in download_with_retries
    return await download(client, task_id, source, target, progress, token_bucket)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\http.py", line 80, in download
    async for chunk in response.aiter_bytes(chunk_size=CHUNK_SIZE):
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpx\_models.py", line 933, in aiter_bytes
    async for raw_bytes in self.aiter_raw():
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpx\_models.py", line 991, in aiter_raw
    async for raw_stream_bytes in self.stream:
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpx\_client.py", line 147, in __aiter__
    async for chunk in self._stream:
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpx\_transports\default.py", line 251, in __aiter__
    with map_httpcore_exceptions():
  File "C:\Users\stati\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\httpx\_transports\default.py", line 84, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ReadError
Traceback (most recent call last):
  File "C:\Users\stati\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\stati\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\__main__.py", line 3, in <module>
    main()
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\console.py", line 321, in main
    args.func(args)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\commands\download.py", line 170, in download
    download_one(video_id, args)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\commands\download.py", line 176, in download_one
    return _download_video(video_id, args)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\commands\download.py", line 316, in _download_video
    asyncio.run(download_all(sources, targets, args.max_workers, rate_limit=args.rate_limit))
  File "C:\Users\stati\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\stati\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\http.py", line 129, in download_all
    await asyncio.gather(*tasks)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\http.py", line 106, in download_with_retries
    return await download(client, task_id, source, target, progress, token_bucket)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\http.py", line 84, in download
    progress.advance(task_id, size)
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\progress.py", line 65, in advance
    self._calculate_progress()
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\progress.py", line 105, in _calculate_progress
    self.speed = self._calculate_speed()
  File "F:\vidsnvods\twitch-dl\twitch-dl.2.1.4.pyz\twitchdl\progress.py", line 119, in _calculate_speed
    return size / duration
ZeroDivisionError: float division by zero
KoenDG commented 8 months ago

The last line there says:

    return size / duration
ZeroDivisionError: float division by zero

Are you still having this issue? Can you check if the video is actually up and has a non-zero length?

Also, if you did the upgrade of those packages, did you do it just with their names, or with the added version constraints?

H-F-T commented 8 months ago

Are you still having this issue? Can you check if the video is actually up and has a non-zero length?

Yes guess I figured it out. Used to be able to download ongoing VOD that hasn't ended but now if I try to do that it gives me this error. I do have time constraints in my command that seem to cause this "--start=00:03:00 --end=00:05:00" and if I remove this it works. The time constraint only works for VOD that has finished. So this broke quiet recently and that is the error.

Also, if you did the upgrade of those packages, did you do it just with their names, or with the added version constraints?

Updated just with their names, I believe constraints are all within the latest versions of each package, didn't check all of them.