Hi,
I'm completely new to developing OctoPrint plugins so i wanted to follow a few tutorials and see if i could get something working...
Now when trying to start Octoprint, jinja starts throwing these errors:
octoprint.util.jinja - ERROR - Caught exception while compiling template dialogs/about.jinja2 at line 41
ImportError: cannot import name 'open_if_exists' from 'jinja2.loaders'
Full traceback below:
2024-01-19 19:31:06,591 - octoprint.util.jinja - ERROR - Caught exception while compiling template dialogs/about.jinja2 at line 41
Traceback (most recent call last):
File "C:\Devel\OctoPrint\src\octoprint\util\jinja.py", line 255, in _handle_body
return caller()
^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\runtime.py", line 777, in _invoke
rv = self._func(*arguments)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Devel\OctoPrint\src\octoprint\templates\dialogs\about.jinja2", line 161, in macro
File "C:\Devel\OctoPrint\src\octoprint\templates\dialogs\about\supporters.jinja2", line 36, in root
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\environment.py", line 1010, in get_template
return self._load_template(name, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\environment.py", line 969, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\loaders.py", line 125, in load
source, filename, uptodate = self.get_source(environment, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\flask\templating.py", line 62, in get_source
return self._get_source_fast(environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\flask\templating.py", line 95, in _get_source_fast
return loader.get_source(environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\loaders.py", line 558, in get_source
return loader.get_source(environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Devel\OctoPrint\src\octoprint\util\jinja.py", line 106, in get_source
contents = SelectedFilesLoader.get_source(self, environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Devel\OctoPrint\src\octoprint\util\jinja.py", line 75, in get_source
from jinja2.loaders import open_if_exists
ImportError: cannot import name 'open_if_exists' from 'jinja2.loaders' (c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\loaders.py)
2024-01-19 19:31:06,596 - octoprint.util.jinja - ERROR - Caught exception while compiling template dialogs/about.jinja2 at line 41
Traceback (most recent call last):
File "C:\Devel\OctoPrint\src\octoprint\util\jinja.py", line 255, in _handle_body
return caller()
^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\runtime.py", line 763, in __call__
return self._invoke(arguments, autoescape)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\runtime.py", line 777, in _invoke
rv = self._func(*arguments)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Devel\OctoPrint\src\octoprint\templates\dialogs\about.jinja2", line 161, in macro
File "C:\Devel\OctoPrint\src\octoprint\templates\dialogs\about\authors.jinja2", line 36, in root
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\environment.py", line 1010, in get_template
return self._load_template(name, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\environment.py", line 969, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\loaders.py", line 125, in load
source, filename, uptodate = self.get_source(environment, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\flask\templating.py", line 62, in get_source
return self._get_source_fast(environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\flask\templating.py", line 95, in _get_source_fast
return loader.get_source(environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\loaders.py", line 558, in get_source
return loader.get_source(environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Devel\OctoPrint\src\octoprint\util\jinja.py", line 106, in get_source
contents = SelectedFilesLoader.get_source(self, environment, template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Devel\OctoPrint\src\octoprint\util\jinja.py", line 75, in get_source
from jinja2.loaders import open_if_exists
ImportError: cannot import name 'open_if_exists' from 'jinja2.loaders' (c:\Devel\OctoPrint\venv\Lib\site-packages\jinja2\loaders.py)
The jinja file i'm trying to load looks like this:
<h1>Testing...<h1>
<p>Test Tab 123</p>
Nothing complicated just a header and some text...
Things i have tried:
Reinstalling jinja2 via python -m pip install and regular pip install
Restarting everything (obviously)
Any help would be much appreciated!