Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plex add_to_collection : Read timed out

sonikun opened this issue · comments

Confirmation

  • I have read the README.md on the project homepage
  • I have checked if identical issue already exists
  • I have tried downgrading to find version that can be used as a workaround

The problem

It happened all of a today in morning when I tried running the script. It stops at 61% in movies.
image

Error trace / logs

--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 454, in getresponse
    httplib_response = super().getresponse()
  File "/usr/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
TimeoutError: timed out

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 844, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.10/dist-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 538, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 370, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='155.248.246.201', port=32400): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/cli.py", line 25, in wrap
    cmd(*args, **kwargs)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/commands/sync.py", line 68, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/sync.py", line 66, in sync
    self.sync_collection(movie, dry_run=dry_run)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/sync.py", line 128, in sync_collection
    m.add_to_collection()
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/media.py", line 137, in add_to_collection
    self.trakt_api.add_to_collection(self.trakt, self.plex)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/trakt/TraktApi.py", line 182, in add_to_collection
    **pm.to_json(),
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/plex/PlexLibraryItem.py", line 325, in to_json
    "resolution": self.resolution,
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/plex/PlexLibraryItem.py", line 209, in resolution
    stream = self.video_streams[0]
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/plex/PlexLibraryItem.py", line 161, in video_streams
    return self.item.videoStreams()
  File "/usr/local/lib/python3.10/dist-packages/plexapi/video.py", line 105, in videoStreams
    self.reload()
  File "/usr/local/lib/python3.10/dist-packages/plexapi/base.py", line 368, in reload
    return self._reload(key=key, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/plexapi/base.py", line 377, in _reload
    data = self._server.query(key)
  File "/usr/local/lib/python3.10/dist-packages/plexapi/server.py", line 745, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests_cache/session.py", line 103, in get
    return self.request('GET', url, params=params, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests_cache/session.py", line 159, in request
    return super().request(method, url, *args, headers=headers, **kwargs)  # type: ignore  File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests_cache/session.py", line 206, in send
    response = self._send_and_cache(request, actions, cached_response, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests_cache/session.py", line 230, in _send_and_cache
    response = super().send(request, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 532, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='155.248.246.201', port=32400): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/logging.py", line 42, in format
    record.msg = self.remove_markup(record.msg)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/logging.py", line 47, in remove_markup
    return re.sub(pattern, '', text)
  File "/usr/lib/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
Call stack:
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/__main__.py", line 18, in <module>
    cli()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 1635, in invoke
    rv = super().invoke(ctx)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/cli.py", line 71, in cli
    sync()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/ubuntu/Repository/PlexTraktSync/plextraktsync/cli.py", line 28, in wrap
    logger.exception(e)
Message: ReadTimeout(ReadTimeoutError("HTTPConnectionPool(host='155.248.246.201', port=32400): Read timed out. (read timeout=30)"))
Arguments: ()

Expected behavior

Sync should run without errors.

Steps to reproduce the behavior

  1. I used python3 -m plextraktsync
  2. Also when using bash plextraktsync.sh

Inspect of problematic items

No response

Workarounds

No response

Install method

git clone (not supported)

Config file contents

# Config File: /home/ubuntu/Repository/PlexTraktSync/config.yml
cache:
  path: /home/ubuntu/Repository/PlexTraktSync/trakt_cache
excluded-libraries:
- Private
- Family Holidays
config:
  dotenv_override: true
plex:
  timeout: 30
logging:
  append: false
  console_time: false
  debug: true
  filename: plextraktsync.log
  filter_loggers: null
  filter: null
sync:
  plex_to_trakt:
    collection: true
    clear_collected: true
    ratings: true
    watched_status: true
    watchlist: false
  trakt_to_plex:
    liked_lists: false
    ratings: true
    watched_status: true
    watchlist: false
    watchlist_as_playlist: false
watch:
  add_collection: true
  remove_collection: true
  scrobble_threshold: 80
  username_filter: true
  media_progressbar: true
xbmc-providers:
  movies: imdb
  shows: tvdb

Version

PlexTraktSync 0.26.0dev0: 299113e

Python Version

Python 3.10.6

Operating System and Version

Ubuntu 22.04.2 LTS

Also getting these handing errors
image

Idk how to paste it, formatting issue

seems duplicate of :

Try to update to last version 0.26.5 and set plex timeout to 300, then give full log.