You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a TypeError when attempting to build my site using Maverick. The error message indicates that a NoneType object is being found where a str instance is expected.
Error Log
Traceback (most recent call last):
File "./build.py", line 43, in <module>
main(sys.argv[1:])
File "./build.py", line 39, in main
builder.build_all()
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Maverick/Maverick/Builder.py", line 173, in build_all
self._template.render(self._config, self._posts, self._pages)
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Galileo/__init__.py", line 22, in render
Galileo(conf, posts, pages)()
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Maverick/Maverick/Template.py", line 155, in __call__
self.render()
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Galileo/__init__.py", line 39, in render
self.build_search_cache()
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Maverick/Maverick/Utils.py", line 42, in wrapper
func(*args, **kwargs)
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Galileo/__init__.py", line 266, in build_search_cache
cache_str = render_search_cache(self._posts, self._pages)
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Galileo/__init__.py", line 256, in render_search_cache
posts = [gen_entry(post) for post in post_list if not post.skip]
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Galileo/__init__.py", line 256, in <listcomp>
posts = [gen_entry(post) for post in post_list if not post.skip]
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Galileo/__init__.py", line 252, in gen_entry
"permalink": router.gen_permalink('tag', tag, 1)
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Maverick/Maverick/Router.py", line 35, in gen_permalink
link, _ = self.gen(type, slug, page)
File "/home/runner/work/Blog-With-GitHub-Boilerplate/Blog-With-GitHub-Boilerplate/Maverick/Maverick/Router.py", line 60, in gen
path = "/".join(routes)
TypeError: sequence item 1: expected str instance, NoneType found
Analysis
It appears that the error occurs in the gen() method in Router.py when the routes list contains a None value. This can happen if type or slug are not correctly defined.
Proposed Solution
I suggest adding a validation check in the gen() method to ensure that no None values are present in the routes list before attempting to join them into a path.
Description
I encountered a
TypeError
when attempting to build my site using Maverick. The error message indicates that aNoneType
object is being found where astr
instance is expected.Error Log
Analysis
It appears that the error occurs in the
gen()
method inRouter.py
when theroutes
list contains aNone
value. This can happen iftype
orslug
are not correctly defined.Proposed Solution
I suggest adding a validation check in the
gen()
method to ensure that noNone
values are present in theroutes
list before attempting to join them into a path.Here is a potential fix for
Router.py
:This code adds a check to raise a
ValueError
if anyNone
values are found in theroutes
list.Steps to Reproduce
Environment
Thank you for your assistance in resolving this issue.
The text was updated successfully, but these errors were encountered: