Error in trakt-login since 0.27.16 on DSM 7 and python 3.8
Viserius 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
After performing a fresh install using pip, the following error is raised:
redacted@redacted:~$ sudo plextraktsync trakt-login
ERROR 'type' object is not subscriptable
Error trace / logs
╭──────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────
│ /usr/lib/python3.8/site-packages/plextraktsync/cli.py:26 in wrap │
│ │
│ 23 │ │ │ cmd = getattr(module, name) │
│ 24 │ │ │ │
│ 25 │ │ │ try: │
│ ❱ 26 │ │ │ │ cmd(*args, **kwargs) │
│ 27 │ │ │ except ClickException as e: │
│ 28 │ │ │ │ from plextraktsync.factory import logger │
│ 29 │ │ │ │ logger.fatal(f"Error running {name} command: {str(e)}") │
│ │
│ /usr/lib/python3.8/site-packages/plextraktsync/commands/trakt_login.py:66 in trakt_login │
│ │
│ 63 │ """ │
│ 64 │ Log in to Trakt Account to obtain Access Token. │
│ 65 │ """ │
│ ❱ 66 │ login() │
│ 67 │
│ 68 │
│ 69 def login(): │
│ │
│ /usr/lib/python3.8/site-packages/plextraktsync/commands/trakt_login.py:71 in login │
│ │
│ 68 │
│ 69 def login(): │
│ 70 │ print = factory.print │
│ ❱ 71 │ api = factory.trakt_api │
│ 72 │ trakt_authenticate(api) │
│ 73 │ user = api.me.username │
│ 74 │
│ │
│ /usr/lib/python3.8/functools.py:967 in __get__ │
│ │
│ 964 │ │ │ │ # check if another thread filled cache while we awaited lock │
│ 965 │ │ │ │ val = cache.get(self.attrname, _NOT_FOUND) │
│ 966 │ │ │ │ if val is _NOT_FOUND: │
│ ❱ 967 │ │ │ │ │ val = self.func(instance) │
│ 968 │ │ │ │ │ try: │
│ 969 │ │ │ │ │ │ cache[self.attrname] = val │
│ 970 │ │ │ │ │ except TypeError: │
│ │
│ /usr/lib/python3.8/site-packages/plextraktsync/util/Factory.py:38 in trakt_api │
│ │
│ 35 │ │
│ 36 │ @cached_property │
│ 37 │ def trakt_api(self): │
│ ❱ 38 │ │ from plextraktsync.trakt.TraktApi import TraktApi │
│ 39 │ │ │
│ 40 │ │ return TraktApi() │
│ 41 │
│ │
│ /usr/lib/python3.8/site-packages/plextraktsync/trakt/TraktApi.py:22 in <module> │
│ │
│ 19 from plextraktsync.path import pytrakt_file │
│ 20 from plextraktsync.trakt.PartialTraktMedia import PartialTraktMedia │
│ 21 from plextraktsync.trakt.TraktLookup import TraktLookup │
│ ❱ 22 from plextraktsync.trakt.TraktRatingCollection import TraktRatingCollection │
│ 23 from plextraktsync.trakt.types import TraktMedia │
│ 24 │
│ 25 if TYPE_CHECKING: │
│ │
│ /usr/lib/python3.8/site-packages/plextraktsync/trakt/TraktRatingCollection.py:11 in <module> │
│ │
│ 8 │ from plextraktsync.trakt.TraktApi import TraktApi │
│ 9 │
│ 10 │
│ ❱ 11 class TraktRatingCollection(dict[str, dict[int, int]]): │
│ 12 │ """ │
│ 13 │ A dictionary of: │
│ 14 │ ["movies", "shows", "episodes"] => { │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
TypeError: 'type' object is not subscriptable
Error: Error running trakt_login command: 'type' object is not subscriptable
Expected behavior
No error is raised, and I am able to enter my credentials
Steps to reproduce the behavior
sudo python3 -m pip install plextraktsync
sudo plextraktsync trakt-login
Inspect of problematic items
No response
Workarounds
Version 0.27.15 works flawlessly, the problem is introduced in version 0.27.16.
Install method
pip (not supported)
Config file contents
# Config File: /root/.config/PlexTraktSync/config.yml
cache:
path: /root/.cache/PlexTraktSync/trakt_cache
excluded-libraries:
- Private
- Family Holidays
config:
dotenv_override: true
plex:
timeout: 30
logging:
append: true
console_time: false
debug: false
filename: plextraktsync.log
filter_loggers: null
filter: null
sync:
plex_to_trakt:
collection: true
clear_collected: false
ratings: true
watched_status: true
watchlist: true
trakt_to_plex:
liked_lists: true
ratings: true
watched_status: true
watchlist: true
watchlist_as_playlist: false
rating_priority: plex
watch:
add_collection: false
remove_collection: false
scrobble_threshold: 80
username_filter: true
media_progressbar: true
xbmc-providers:
movies: imdb
shows: tvdb
Version
0.27.16
Python Version
3.8.12
Plex Server Version
1.32.7.7621
Operating System and Version
DSM 7.1.1 update 6
first of all. do not run this program as root. it does not require any elevated privileges to run.
the diff:
the only suspicous change I see now is this:
-class TraktRatingCollection(dict):
+class TraktRatingCollection(dict[str, dict[int, int]]):
I'm wondering if this typing breaks python 3.8. are you able to undo that change and re-test?