Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Movie' object has no attribute 'trakt' #158

Open
Ashish0804 opened this issue Oct 4, 2021 · 3 comments
Open

AttributeError: 'Movie' object has no attribute 'trakt' #158

Ashish0804 opened this issue Oct 4, 2021 · 3 comments

Comments

@Ashish0804
Copy link

Looks like trakt was never initialized and thus error.

return {'ids': {'trakt': self.trakt, 'slug': self.slug,

Changing it to trakt_id should fix things but I haven't tested it myself.

Here's the full error log

Traceback (most recent call last):
  File ".\add2traktlist.py", line 56, in <module>
    main()
  File ".\add2traktlist.py", line 51, in main
    traktList.add_items(trakt_object)
  File "C:\Users\Ashish\Anaconda3\lib\site-packages\trakt\core.py", line 586, in inner
    url, generator, args = self._get_first(f, *args, **kwargs)
  File "C:\Users\Ashish\Anaconda3\lib\site-packages\trakt\core.py", line 494, in _get_first
    uri = next(generator)
  File "C:\Users\Ashish\Anaconda3\lib\site-packages\trakt\users.py", line 160, in add_items
    movies = [m.ids for m in items if isinstance(m, Movie)]
  File "C:\Users\Ashish\Anaconda3\lib\site-packages\trakt\users.py", line 160, in <listcomp>
    movies = [m.ids for m in items if isinstance(m, Movie)]
  File "C:\Users\Ashish\Anaconda3\lib\site-packages\trakt\movies.py", line 194, in ids
    return {'ids': {'trakt': self.trakt, 'slug': self.slug,
AttributeError: 'Movie' object has no attribute 'trakt'

Here's how Movie object is being used in my code

Movie(title=res['Title'], imdb_id=res['imdbID'])

res is the response for OMDB api.

@Ashish0804
Copy link
Author

There are other errors on that line

This fixed them

        return {'ids': {'trakt': self.trakt_id, 'slug': self.slug,
                        'imdb': self.imdb_id, 'tmdb': self.tmdb_id}}

@glensc
Copy link
Contributor

glensc commented Jan 15, 2022

you are using constructor with data in an unexpected way:

Movie(title=res['Title'], imdb_id=res['imdbID'])

you need to pass ids as ids=dict rather than individual parameters:

Movie(title=res['Title'], ids= {'trakt': trakt_id, 'slug': self.slug,  'imdb': self.imdb_id, 'tmdb': self.tmdb_id})

this is later filled into *_id via extract_ids (in method _build).

@glensc
Copy link
Contributor

glensc commented Nov 29, 2022

Adding .trakt in my fork:

but due to different reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants