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

ModuleNotFoundError: No module named 'plextraktsync.media.MediaFactory'; 'plextraktsync.media' is not a package

tangcla 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

Looks to be a similar issue to #1828, #1839
ModuleNotFoundError: No module named 'plextraktsync.media.MediaFactory'; 'plextraktsync.media' is not a package

Steps to reproduce the behavior

  1. Re-run settings from scratch
  2. Run the batch file to kick off the process
  3. Uninstalled all versions of Python and reinstalled
  4. Reinstalled settings after Python installation
  5. Tried upgrading to latest version (0.29.10)
  6. Tried downgrading to older versions (back as far as to 0.28.21)

Error trace / logs

WARNING  No git dir found
INFO     PlexTraktSync [0.29.0dev0]
INFO     Connecting with url: https://192-168-50-194.28fc260e1df44d768cc7b7908104aa90.plex.direct:32400, timeout 30
         seconds
ERROR    No module named 'plextraktsync.media.MediaFactory'; 'plextraktsync.media' is not a package
         ╭───────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────╮
         │ D:\Program Files\PlexTraktSync\plextraktsync\cli.py:26 in wrap                                              │
         │                                                                                                             │
         │    23 │   │   │   cmd = getattr(module, name)                                                               │
         │    24 │   │   │                                                                                             │
         │    25 │   │   │   try:                                                                                      │
         │ ❱  26 │   │   │   │   cmd(*args, **kwargs)                                                                  │
         │    27 │   │   │   except EOFError as e:                                                                     │
         │    28 │   │   │   │   raise ClickException(f"Program requested terminal, No terminal is                     │
         │       connected: {e}")                                                                                      │
         │    29 │   │   │   except ClickException as e:                                                               │
         │                                                                                                             │
         │ D:\Program Files\PlexTraktSync\plextraktsync\commands\sync.py:46 in sync                                    │
         │                                                                                                             │
         │   43 │                                                                                                      │
         │   44 │   ensure_login()                                                                                     │
         │   45 │   wc = factory.walk_config.update(movies=movies, shows=shows, watchlist=watchlist)                   │
         │ ❱ 46 │   w = factory.walker                                                                                 │
         │   47 │                                                                                                      │
         │   48 │   if ids:                                                                                            │
         │   49 │   │   for id in ids:                                                                                 │
         │                                                                                                             │
         │ C:\Program                                                                                                  │
         │ Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64__qbz5n2kfra8p0\Lib\functools.py:995   │
         │ in __get__                                                                                                  │
         │                                                                                                             │
         │    992 │   │   │   raise TypeError(msg) from None                                                           │
         │    993 │   │   val = cache.get(self.attrname, _NOT_FOUND)                                                   │
         │    994 │   │   if val is _NOT_FOUND:                                                                        │
         │ ❱  995 │   │   │   val = self.func(instance)                                                                │
         │    996 │   │   │   try:                                                                                     │
         │    997 │   │   │   │   cache[self.attrname] = val                                                           │
         │    998 │   │   │   except TypeError:                                                                        │
         │                                                                                                             │
         │ D:\Program Files\PlexTraktSync\plextraktsync\util\Factory.py:187 in walker                                  │
         │                                                                                                             │
         │   184 │   │   walk_config = self.walk_config                                                                │
         │   185 │   │   plex = self.plex_api                                                                          │
         │   186 │   │   trakt = self.trakt_api                                                                        │
         │ ❱ 187 │   │   mf = self.media_factory                                                                       │
         │   188 │   │   pb = self.progressbar                                                                         │
         │   189 │   │   w = Walker(plex=plex, trakt=trakt, mf=mf, config=walk_config, progressbar=pb)                 │
         │   190                                                                                                       │
         │                                                                                                             │
         │ C:\Program                                                                                                  │
         │ Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64__qbz5n2kfra8p0\Lib\functools.py:995   │
         │ in __get__                                                                                                  │
         │                                                                                                             │
         │    992 │   │   │   raise TypeError(msg) from None                                                           │
         │    993 │   │   val = cache.get(self.attrname, _NOT_FOUND)                                                   │
         │    994 │   │   if val is _NOT_FOUND:                                                                        │
         │ ❱  995 │   │   │   val = self.func(instance)                                                                │
         │    996 │   │   │   try:                                                                                     │
         │    997 │   │   │   │   cache[self.attrname] = val                                                           │
         │    998 │   │   │   except TypeError:                                                                        │
         │                                                                                                             │
         │ D:\Program Files\PlexTraktSync\plextraktsync\util\Factory.py:54 in media_factory                            │
         │                                                                                                             │
         │    51 │                                                                                                     │
         │    52 │   @cached_property                                                                                  │
         │    53 │   def media_factory(self):                                                                          │
         │ ❱  54 │   │   from plextraktsync.media.MediaFactory import MediaFactory                                     │
         │    55 │   │                                                                                                 │
         │    56 │   │   trakt = self.trakt_api                                                                        │
         │    57 │   │   plex = self.plex_api                                                                          │
         ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
         ModuleNotFoundError: No module named 'plextraktsync.media.MediaFactory'; 'plextraktsync.media' is not a package
Error: Error running sync command: No module named 'plextraktsync.media.MediaFactory'; 'plextraktsync.media' is not a package

Expected behavior

Sync to kick off sync

Inspect of problematic items

WARNING  No git dir found
PlexTraktSync [0.29.0dev0]
ERROR    Unable to create PlexId: ID
         ╭───────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────╮
         │ D:\Program Files\PlexTraktSync\plextraktsync\cli.py:26 in wrap                                              │
         │                                                                                                             │
         │    23 │   │   │   cmd = getattr(module, name)                                                               │
         │    24 │   │   │                                                                                             │
         │    25 │   │   │   try:                                                                                      │
         │ ❱  26 │   │   │   │   cmd(*args, **kwargs)                                                                  │
         │    27 │   │   │   except EOFError as e:                                                                     │
         │    28 │   │   │   │   raise ClickException(f"Program requested terminal, No terminal is                     │
         │       connected: {e}")                                                                                      │
         │    29 │   │   │   except ClickException as e:                                                               │
         │                                                                                                             │
         │ D:\Program Files\PlexTraktSync\plextraktsync\commands\inspect.py:107 in inspect                             │
         │                                                                                                             │
         │   104 │   print = factory.print                                                                             │
         │   105 │   print(f"PlexTraktSync [{factory.version.full_version}]")                                          │
         │   106 │                                                                                                     │
         │ ❱ 107 │   for plex_id in expand_plexid(inputs):                                                             │
         │   108 │   │   inspect_media(plex_id)                                                                        │
         │   109                                                                                                       │
         │                                                                                                             │
         │ D:\Program Files\PlexTraktSync\plextraktsync\util\expand_id.py:39 in expand_plexid                          │
         │                                                                                                             │
         │   36 │   from plextraktsync.plex.PlexIdFactory import PlexIdFactory                                         │
         │   37 │                                                                                                      │
         │   38 │   for id in input:                                                                                   │
         │ ❱ 39 │   │   yield PlexIdFactory.create(id)                                                                 │
         │   40                                                                                                        │
         │   41                                                                                                        │
         │   42 def expand_id(input):                                                                                  │
         │                                                                                                             │
         │ D:\Program Files\PlexTraktSync\plextraktsync\plex\PlexIdFactory.py:18 in create                             │
         │                                                                                                             │
         │   15 │   │   elif key.startswith("plex://"):                                                                │
         │   16 │   │   │   return cls.from_plex_guid(key)                                                             │
         │   17 │   │                                                                                                  │
         │ ❱ 18 │   │   raise RuntimeError(f"Unable to create PlexId: {key}")                                          │
         │   19 │                                                                                                      │
         │   20 │   @classmethod                                                                                       │
         │   21 │   def from_plex_guid(cls, id):                                                                       │
         ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
         RuntimeError: Unable to create PlexId: ID
Error: Error running inspect command: Unable to create PlexId: ID

Workarounds

No response

Config file contents

# Config File: D:\Program Files\PlexTraktSync\config.yml
cache:
  path: D:\Program Files\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:
  rating_priority: plex
  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
watch:
  add_collection: false
  remove_collection: false
  scrobble_threshold: 80
  username_filter: true
  media_progressbar: true
xbmc-providers:
  movies: imdb
  shows: tvdb

Install method

zip download (not supported)

Version

0.29.10

Python Version

3.12.2

Plex Server Version

1.40.2.8312

Operating System and Version

Windows 11

not supported install method. unclear how was installed or what commands were ran.

use pipx or docker image

Yes, it might be an unsupported install method, but the problem is the same as the other ticket #1828 and #1839 with supported images.

I do not know what you have done to create that situation. you need to describe exactly how to reproduce this problem. the issues you link are fixed, so those can't be the problems anymore. no new module has been added since then and recent releases work okay.

likely if you try to figure out exact actions to do, the problem will go away. my guess is that you have mixed files from different versions.