Plugin install errors (TypeError: '<' not supported between instances of 'int' and 'NoneType')

24 views
Skip to first unread message

Erik Ritch

unread,
Jul 12, 2020, 6:44:31 PM7/12/20
to nikola-discuss
I recently upgraded from version 8.0.4 to 8.1.1 and was creating a new environment on a new computer.  When attempting to install the plugins that I use, I keep running into the following error from Nikola.

Traceback (most recent call last):
 
File "c:\program files (x86)\python38-32\lib\runpy.py", line 194, in _run_module_as_main
   
return _run_code(code, main_globals, None,
 
File "c:\program files (x86)\python38-32\lib\runpy.py", line 87, in _run_code
   
exec(code, run_globals)
 
File "C:\Users\ejunk\nikola-env\Scripts\nikola.exe\__main__.py", line 7, in <module>
 
File "c:\users\ejunk\nikola-env\lib\site-packages\nikola\__main__.py", line 167, in main
    _
= DN.run(oargs)
 
File "c:\users\ejunk\nikola-env\lib\site-packages\nikola\__main__.py", line 341, in run
   
self.nikola.init_plugins(load_all=True)
 
File "c:\users\ejunk\nikola-env\lib\site-packages\nikola\nikola.py", line 1073, in init_plugins
   
self.plugin_manager._candidates = self._filter_duplicate_plugins(self.plugin_manager._candidates)
 
File "c:\users\ejunk\nikola-env\lib\site-packages\nikola\nikola.py", line 996, in _filter_duplicate_plugins
    plugins
.sort(key=plugin_position_in_places)
TypeError: '<' not supported between instances of 'int' and 'NoneType'

The error does not seem to be limited to a single plugin.  Sometimes I can install one or two plugins before I get the error and sometimes it happens with the first plugin I install.  Once the error happens, the only way to get Nikola to do anything is to delete all the plugins.  This is being done in a fresh virtualenv and a fresh nikola site (nikola init mysite).  I am attempting to install the plugins sass, sidebar, file_tree_subs, tags, static_tag_cloud, and localsearch.

OS is Windows 10 home, version 1909
Python 3.8.3 x32
Nikola 8.1.1

Any help you can give would be greatly appreciated!

Erik

Chris Warrick

unread,
Jul 13, 2020, 9:05:19 AM7/13/20
to Nikola—Discuss
> --
> You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/24a7c8b3-e0bd-45d6-9f3b-05be077e2973o%40googlegroups.com.

Cannot reproduce with a similar configuration (64-bit Python on
Windows). file_tree_subs is not a Nikola plugin. Do you have any
global plugins (~/.nikola/plugins)? Could you modify the
_filter_duplicate_plugins functions on line 985 in nikola.py like this
and show the resulting errors?

def plugin_position_in_places(plugin):
# plugin here is a tuple:
# (path to the .plugin file, path to plugin module w/o
.py, plugin metadata)
for i, place in enumerate(self._plugin_places):
if plugin[0].startswith(place):
utils.LOGGER.warn("{}: {}, {}".format(i, place, plugin))
return i
utils.LOGGER.warn("None: {}, {}".format(place, plugin))


--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Erik Ritch

unread,
Jul 13, 2020, 12:11:09 PM7/13/20
to nikola-discuss
It would appear that the problem was global plugins.  I did not realize that I had any (I'm not sure how I ended up with any and certainly didn't mean to have any) but as soon as I deleted everything from ~/.nikola/plugins, the error went away and Nikola is now working normally.  So, the problem appears to be related to having a global plugin and, most likely, installing that same plugin locally.
> To unsubscribe from this group and stop receiving emails from it, send an email to nikola-...@googlegroups.com.

Chris Warrick

unread,
Jul 13, 2020, 1:35:11 PM7/13/20
to Nikola—Discuss
I couldn’t reproduce in the global-and-local-plugins scenario either.
Could you help debug the issue by restoring global plugins, patching
nikola.py and showing the log output?

Erik Ritch

unread,
Jul 13, 2020, 4:15:16 PM7/13/20
to nikola-discuss
Ok.  Global plugin folder now contains the sidebar plugin.

nikola plugin -i sass
[2020-07-13 14:12:19] WARNING: Nikola: None: C:\Users\ejunk\new-env\mysite\plugins, ('C:\\Users\\ejunk\\.nikola\\plugins\\sidebar\\sidebar.plugin', 'C:\\Users\\ejunk\\.nikola\\plugins\\sidebar\\sidebar', <yapsy.PluginInfo.PluginInfo object at 0x000001E544ADA7F0>)
[2020-07-13 14:12:19] WARNING: Nikola: 2: C:\Users\ejunk\new-env\mysite\plugins, ('C:\\Users\\ejunk\\new-env\\mysite\\plugins\\sidebar\\sidebar.plugin', 'C:\\Users\\ejunk\\new-env\\mysite\\plugins\\sidebar\\sidebar', <yapsy.PluginInfo.PluginInfo object at 0x000001E544ADA850>)

Traceback (most recent call last):

 
File "c:\program files\python38\lib\runpy.py", line 194, in _run_module_as_main
   
return _run_code(code, main_globals, None,
 
File "c:\program files\python38\lib\runpy.py", line 87, in _run_code
   
exec(code, run_globals)
 
File "C:\Users\ejunk\new-env\Scripts\nikola.exe\__main__.py", line 7, in <module>
 
File "c:\users\ejunk\new-env\lib\site-packages\nikola\__main__.py", line 167, in main
    _
= DN.run(oargs)
 
File "c:\users\ejunk\new-env\lib\site-packages\nikola\__main__.py", line 341, in run
   
self.nikola.init_plugins(load_all=True)
 
File "c:\users\ejunk\new-env\lib\site-packages\nikola\nikola.py", line 1075, in init_plugins
   
self.plugin_manager._candidates = self._filter_duplicate_plugins(self.plugin_manager._candidates)
 
File "c:\users\ejunk\new-env\lib\site-packages\nikola\nikola.py", line 998, in _filter_duplicate_plugins
    plugins
.sort(key=plugin_position_in_places)

TypeError: '<' not supported between instances of 'int' and 'NoneType'

Is that the debug information that you need?

Erik Ritch

unread,
Jul 13, 2020, 4:16:42 PM7/13/20
to nikola-discuss
Oh, and I did switched over to Python 3.8.3 x64 since that is what you are using.  If I delete the global plugin, the above command completes without error.

Chris Warrick

unread,
Jul 13, 2020, 6:03:50 PM7/13/20
to Nikola—Discuss
On Mon, 13 Jul 2020 at 22:15, Erik Ritch <eri...@gmail.com> wrote:
> Ok. Global plugin folder now contains the sidebar plugin.
>
> nikola plugin -i sass
> [2020-07-13 14:12:19] WARNING: Nikola: None: C:\Users\ejunk\new-env\mysite\plugins, ('C:\\Users\\ejunk\\.nikola\\plugins\\sidebar\\sidebar.plugin', 'C:\\Users\\ejunk\\.nikola\\plugins\\sidebar\\sidebar', <yapsy.PluginInfo.PluginInfo object at 0x000001E544ADA7F0>)
> [2020-07-13 14:12:19] WARNING: Nikola: 2: C:\Users\ejunk\new-env\mysite\plugins, ('C:\\Users\\ejunk\\new-env\\mysite\\plugins\\sidebar\\sidebar.plugin', 'C:\\Users\\ejunk\\new-env\\mysite\\plugins\\sidebar\\sidebar', <yapsy.PluginInfo.PluginInfo object at 0x000001E544ADA850>)
> Traceback (most recent call last):
> File "c:\program files\python38\lib\runpy.py", line 194, in _run_module_as_main
> return _run_code(code, main_globals, None,
> File "c:\program files\python38\lib\runpy.py", line 87, in _run_code
> exec(code, run_globals)
> File "C:\Users\ejunk\new-env\Scripts\nikola.exe\__main__.py", line 7, in <module>
> File "c:\users\ejunk\new-env\lib\site-packages\nikola\__main__.py", line 167, in main
> _ = DN.run(oargs)
> File "c:\users\ejunk\new-env\lib\site-packages\nikola\__main__.py", line 341, in run
> self.nikola.init_plugins(load_all=True)
> File "c:\users\ejunk\new-env\lib\site-packages\nikola\nikola.py", line 1075, in init_plugins
> self.plugin_manager._candidates = self._filter_duplicate_plugins(self.plugin_manager._candidates)
> File "c:\users\ejunk\new-env\lib\site-packages\nikola\nikola.py", line 998, in _filter_duplicate_plugins
> plugins.sort(key=plugin_position_in_places)
> TypeError: '<' not supported between instances of 'int' and 'NoneType'
>
> Is that the debug information that you need?

Yes. That ended up being a classic slashes-vs-backslashes bug in a
place that isn’t exercised too often (Windows + user-wide plugins +
duplicates in site is a very specific combination). Here's a PR to fix
it: https://github.com/getnikola/nikola/pull/3438

Erik Ritch

unread,
Jul 13, 2020, 8:31:36 PM7/13/20
to nikola-discuss
Ahh, path handling in Windows vs Linux.  Whenever I write a python program under Windows, I absolutely hate path handling.  Thanks for the patch and, yes, I imagine this would be a super-edge case.

José Abílio Matos

unread,
Jul 14, 2020, 1:46:27 PM7/14/20
to nikola-...@googlegroups.com
On Monday, 13 July 2020 23.03.36 WEST Chris Warrick wrote:
> Yes. That ended up being a classic slashes-vs-backslashes bug in a
> place that isn’t exercised too often (Windows + user-wide plugins +
> duplicates in site is a very specific combination). Here's a PR to fix
> it: https://github.com/getnikola/nikola/pull/3438

At some point pathlib will be an interesting option to solve this case. :-)

pathlib was introduced in python 3.4 but it (mostly) works like strings, in
all places where a path is required, since python 3.6.

--
José Matos


Reply all
Reply to author
Forward
0 new messages