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

TypeError: string indices must be integers #6

Open
LYS1THEA opened this issue Apr 11, 2023 · 4 comments
Open

TypeError: string indices must be integers #6

LYS1THEA opened this issue Apr 11, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@LYS1THEA
Copy link

> nfo generate -tvdb 305074 -imdb tt5626028 My.Hero.Academia.S06E01.1080p.CR.WEB-DL.DDP2.0.H.264-GROUP.mkv episode 1 "My Hero Academia" 6
Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\Scripts\nfo.exe\__main__.py", line 7, in <module>
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1626, in _process_result
    value = ctx.invoke(self._result_callback, value, **ctx.params)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\pynfogen\cli\generate.py", line 122, in generator
    nfo_txt = nfo.run(template_text, art=artwork_text, **template_vars)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\pynfogen\nfo.py", line 116, in run
    template = CustomFormats().format(template, **variables)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\string.py", line 161, in format
    return self.vformat(format_string, args, kwargs)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\string.py", line 165, in vformat
    result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\string.py", line 205, in _vformat
    obj, arg_used = self.get_field(field_name, args, kwargs)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\string.py", line 278, in get_field
    obj = obj[i]
TypeError: string indices must be integers
@CitizenDev
Copy link

Same issue here

@rlaphoenix
Copy link
Owner

This indicates an issue with one of the formatting variables inside the NFO Template. Though may also happen in your Description Template. The exact issue cannot be inferred from the log.

However, you can see it's having an error doing obj[i] where obj is a string and i is ALSO a string. E.g. foo = "Hello World"; foo["Hello"]. This is a Runtime error. It is not immediately clear as to why this occurred. In the example templates only the imdb is accessed via indexing ([...]), specifically to get the title and year. The Cinemageor project is used to talk with IMDb and has been having issues with IMDb's updates. Even the latest release is fairly broken. What's possible is the imdb variable exposed to templates is not as expected and is now a string or some other crap variable.

Therefore, this would be an upstream issue that I cannot fix here. A temporary solution is to install the latest code from the Cinemagoer GitHub repository, which is never really recommended for various reasons, but I have done this before and it worked fine.

@rlaphoenix rlaphoenix self-assigned this Oct 5, 2023
@rlaphoenix rlaphoenix added the bug Something isn't working label Oct 5, 2023
@CitizenDev
Copy link

This indicates an issue with one of the formatting variables inside the NFO Template. Though may also happen in your Description Template. The exact issue cannot be inferred from the log.

However, you can see it's having an error doing obj[i] where obj is a string and i is ALSO a string. E.g. foo = "Hello World"; foo["Hello"]. This is a Runtime error. It is not immediately clear as to why this occurred. In the example templates only the imdb is accessed via indexing ([...]), specifically to get the title and year. The Cinemageor project is used to talk with IMDb and has been having issues with IMDb's updates. Even the latest release is fairly broken. What's possible is the imdb variable exposed to templates is not as expected and is now a string or some other crap variable.

Therefore, this would be an upstream issue that I cannot fix here. A temporary solution is to install the latest code from the Cinemagoer GitHub repository, which is never really recommended for various reasons, but I have done this before and it worked fine.

It's a stock example template movie.nfo from this repo.

@rlaphoenix
Copy link
Owner

Then yeah it's likely the Cinemagoer project. I'll look further into it and see if I can find a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants