Section nav error: TypeError: unsupported operand type(s) for +: 'int' and 'str'
See original GitHub issue- [ x] I’ve read the contribution guidelines and agree with them
I’ve found a bug and checked that …
- [ x] … the problem doesn’t occur with the default MkDocs template
- [x ] … the problem is not in any of my customizations (CSS, JS, template)
- [ x] … the documentation does not mention anything about my problem
- [ x] … there are no open or closed issues that are related to my problem
Description
I get the following error when activating section based navigation with mkdocs-material-6.1.4+insiders-1.9.0
in a minimal website.
ERROR - Exception in callback <bound method LiveReloadHandler.poll_tasks of <class 'livereload.handlers.LiveReloadHandler'>>
Traceback (most recent call last):
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/tornado/ioloop.py", line 907, in _run
return self.callback()
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/livereload/handlers.py", line 69, in poll_tasks
filepath, delay = cls.watcher.examine()
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/livereload/watcher.py", line 119, in examine
func()
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/mkdocs/commands/serve.py", line 136, in builder
build(config, live_server=live_server, dirty=dirty)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/mkdocs/commands/build.py", line 285, in build
_build_theme_template(template, env, files, config, nav)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/mkdocs/commands/build.py", line 108, in _build_theme_template
output = _build_template(template_name, template, files, config, nav)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/mkdocs/commands/build.py", line 87, in _build_template
output = template.render(context)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/material/404.html", line 4, in top-level template code
{% extends "main.html" %}
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/jinja2/environment.py", line 1005, in render
return concat(self.root_render_func(self.new_context(vars)))
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/material/404.html", line 14, in root
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/material/main.html", line 14, in root
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/material/base.html", line 126, in root
<main class="md-main" data-md-component="main">
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/material/base.html", line 360, in block_site_nav
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/material/partials/nav.html", line 59, in root
File "/usr/local/Caskroom/miniconda/base/envs/rapids202008/lib/python3.7/site-packages/material/partials/nav-item.html", line 38, in root
</nav>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Expected behavior
Load the website without errors and with section navigation
Actual behavior
The website is not rendered
Steps to reproduce the bug
- Install
mkdocs-material-6.1.4+insiders-1.9.0
- Setup the mkdocs.yml described below
- Create a test file under
/docs/test.md
with this line# My Test
- mkdocs serve
Package versions
- Python: 3.7.3
python --version
- MkDocs: 1.1.2
mkdocs --version
- Material: Version: 6.1.4+insiders.1.9.0
pip show mkdocs-material | grep -E ^Version
Project configuration
site_name: Test
theme:
name: material
features:
- navigation.sections
nav:
- Others:
- Team: test.md
System information
-
OS: MacOS 10.15.7
-
Browser: Firefox 82.0.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Unsupported operand type(s) for +: 'int' and 'str' - Stack Overflow
You're trying to concatenate a string and an integer, which is incorrect. Change print(numlist.pop(2)+" has been removed") to any of these:.
Read more >Python TypeError: unsupported operand type(s) for -: 'str' and ...
The “TypeError: unsupported operand type(s) for -: 'str' and 'int'” error is raised when you try to subtract a string from an integer....
Read more >Unsupported operand type s for int and str | Edureka Community
You seem to be trying to train a string and an integer, which is incorrect. Alter the print(numlist.pop(2)+" has been removed") to any...
Read more >Unsupported operand type(s) for +: 'int' and 'str' | Neeraj Sharma
To the point and easy explanation why this " TypeError : unsupported operand type ( s) for +: ' int' and 'str '"...
Read more >TypeError: unsupported operand type(s) for +: int and str
The Python "TypeError: unsupported operand type(s) for +: 'int' and 'str'" occurs when we try to use the addition (+) operator with an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We added Jinja as an explicit dependency in https://github.com/squidfunk/mkdocs-material/commit/905c8b77c689e459b37b64564d81775d5ca60879, released as part of 7.3.3, see here:
https://github.com/squidfunk/mkdocs-material/blob/1316d8d184b63ddb9e308956b2599c7320709bf7/requirements.txt#L22
For the Googlers, I ran into the same issue here: https://github.com/binwiederhier/ntfy/actions/runs/1550547757 and fixed it with an explicit jinja2 dependency, here: https://github.com/binwiederhier/ntfy/commit/ab3cc47e272aa0d21f8b3fd134265611916b6416#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552R4
Thanks @liuhualh for the hint and thanks @squidfunk for a freaking awesome piece of software (which has docs here: https://ntfy.sh/docs).