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

[Anilist] free variable 'default' referenced before assignment in enclosing scope #118

Closed
Tawagot0 opened this issue Mar 17, 2021 · 5 comments · Fixed by #122
Closed

[Anilist] free variable 'default' referenced before assignment in enclosing scope #118

Tawagot0 opened this issue Mar 17, 2021 · 5 comments · Fixed by #122
Assignees
Labels
bug Bug is with Plex Meta Manager

Comments

@Tawagot0
Copy link

Tawagot0 commented Mar 17, 2021

Hello! When i set a collection with AniList Seasonal Anime (https://github.com/meisnate12/Plex-Meta-Manager/wiki/AniList-Builders#anilist-seasonal-anime) like this:

collections:
  Fall 2020:
    anilist_season:
      season: fall
      year: 2020
    sync_mode: sync

Logs:

| Scanning Fall 2020 Collection                                                                   |
| Collection Warning: anilist_season sort_by attribute not found using score as default              |
| free variable 'default' referenced before assignment in enclosing scope                            |

But it works very well with studios for example.

meisnate12 added a commit that referenced this issue Mar 17, 2021
@meisnate12
Copy link
Member

ok there should be a fix in develop. can you test?

@Tawagot0
Copy link
Author

| Method: anilist_season                                                                             |
| Value: ordereddict([('season', 'fall'), ('year', 2020)])                                           |
| Collection Warning: anilist_season sort_by attribute not found using score as default              |
| Collection Warning: anilist_season limit attribute not found using 0 as default                    |
|                                                                                                    |
| Method: sync_mode                                                                                  |
| Value: sync                                                                                        |
|                                                                                                    |
| Sync Mode: sync                                                                                    |
|                                                                                                    |
| Method: anilist_season                                                                             |
| Values: [{'sort_by': 'score', 'season': 'fall', 'year': 2020, 'limit': 0}]                         |
|                                                                                                    |
| Value: {'sort_by': 'score', 'season': 'fall', 'year': 2020, 'limit': 0}                            |
| Data: {'sort_by': 'score', 'season': 'fall', 'year': 2020, 'limit': 0}                             |
| Traceback (most recent call last):                                                                 |
|   File "/root/Plex-Meta-Manager/modules/config.py", line 462, in update_libraries                  |
|     builder.run_methods(collection_obj, collection_name, rating_key_map, movie_map, show_map)      |
|   File "/root/Plex-Meta-Manager/modules/builder.py", line 748, in run_methods                      |
|     elif "anilist" in method:                           items_found += check_map(self.config.AniList.get_items(method, value)) |
|   File "/root/Plex-Meta-Manager/modules/anilist.py", line 185, in get_items                        |
|     mal_ids = self.season(data["season"], data["year"], data["sort_by"], data["limit"])            |
|   File "/root/Plex-Meta-Manager/modules/anilist.py", line 95, in season                            |
|     return self.get_pagenation(query, limit=limit, variables=variables)                            |
|   File "/root/Plex-Meta-Manager/modules/anilist.py", line 50, in get_pagenation                    |
|     json_obj = self.send_request(query, variables)                                                 |
|   File "/usr/local/lib/python3.6/dist-packages/retrying.py", line 49, in wrapped_f                 |
|     return Retrying(*dargs, **dkw).call(f, *args, **kw)                                            |
|   File "/usr/local/lib/python3.6/dist-packages/retrying.py", line 206, in call                     |
|     return attempt.get(self._wrap_exception)                                                       |
|   File "/usr/local/lib/python3.6/dist-packages/retrying.py", line 247, in get                      |
|     six.reraise(self.value[0], self.value[1], self.value[2])                                       |
|   File "/usr/local/lib/python3.6/dist-packages/six.py", line 703, in reraise                       |
|     raise value                                                                                    |
|   File "/usr/local/lib/python3.6/dist-packages/retrying.py", line 200, in call                     |
|     attempt = Attempt(fn(*args, **kwargs), attempt_number, False)                                  |
|   File "/root/Plex-Meta-Manager/modules/anilist.py", line 27, in send_request                      |
|     raise Failed(f"AniList Error: {json_obj['errors'][0]['message']}")                             |
| modules.util.Failed: AniList Error: Variable "$season" of type "String" used in position expecting type "MediaSeason". |
|                                                                                                    |
| Unknown Error: AniList Error: Variable "$season" of type "String" used in position expecting type "MediaSeason". |

meisnate12 added a commit that referenced this issue Mar 17, 2021
@meisnate12
Copy link
Member

and boom can you update and try again i think i got it this time

@meisnate12 meisnate12 self-assigned this Mar 17, 2021
@meisnate12 meisnate12 added the bug Bug is with Plex Meta Manager label Mar 17, 2021
@Tawagot0
Copy link
Author

and boom can you update and try again i think i got it this time

Fixed, thanks! 👍

@meisnate12 meisnate12 reopened this Mar 17, 2021
@meisnate12
Copy link
Member

awesome I'm leaving this open until the fix is in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug is with Plex Meta Manager
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants