getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.58k stars 443 forks source link

Running `nikola new_post --available-formats` in a new site throws a TypeError #3750

Closed alexwlchan closed 5 months ago

alexwlchan commented 5 months ago

Environment

Python Version: Python 3.12.0

Nikola Version: Nikola v8.3.0

Operating System: macOS 13.6.3

Description:

If I create a brand new Nikola site and run nikola new_post --available-formats, I get a TypeError rather than a list of formats.

Steps to reproduce:

$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install Nikola[extras]
[…output snippet]
$ nikola init --quiet mydemo
$ cd mydemo/
$ nikola new_post --available-formats
Traceback (most recent call last):
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/doit/doit_cmd.py", line 294, in run
    return command.parse_execute(args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/doit/cmd_base.py", line 150, in parse_execute
    return self.execute(params, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/nikola/plugin_categories.py", line 131, in execute
    return self._execute(options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/nikola/plugins/command/new_post.py", line 247, in _execute
    self.print_compilers()
  File "/private/var/folders/_c/h0g4c9_n6rg8d2v509hztzdc0000gn/T/tmp.TFs3tLwQ/.venv/lib/python3.12/site-packages/nikola/plugins/command/new_post.py", line 523, in print_compilers
    for name, (_, _, pi) in self.site.disabled_compilers.items():
              ^^^^^^^^^^
TypeError: cannot unpack non-iterable PluginCandidate object
alexwlchan commented 5 months ago

@Kwpolska thanks for fixing this so quickly! 💚