Closed tsunamistate closed 9 months ago
Correct, this broke with a recent update to Jinja. I haven't updated here, but it's on my list of updates to make also on the text of the tutorial.
I still am unable to fix this issue, 8 already removed the extensions line from babel.cfg but I'm still getting the error "ValueError: Unknown extraction method 'jinja2'" when I run the pybabel command
@NicolasTfile this is how the babel.cfg file should be with current versions of pybabel: https://github.com/miguelgrinberg/microblog/blob/2023/babel.cfg
Thank you, that is also what I did before but I have fixed my issue now. I had to upgrade my setuptools which fixed the issue for me. For others the command to upgrade setuptools is pip install --upgrade setuptools
Closing as this does not apply to the new edition of this tutorial.
Thank you, that is also what I did before but I have fixed my issue now. I had to upgrade my setuptools which fixed the issue for me. For others the command to upgrade setuptools is pip install --upgrade setuptools
still working
i ran into the identical issue and error: "ValueError: Unknown extraction method 'jinja2'"
.
upgrading setuptools with pip install --upgrade setuptools
also resolved the issue for me.
OS: Windows 11 22H2 Python: v3.11.0 Flask: v2.2.2 Jinja2: 3.1.2 Babel: 2.11.0 Flask-Babel: 2.0.0
After marking needed text for translation and adding
babel.cfg
, trying to extract the text withpybabel extract -F babel.cfg -k _l -o messages.pot .
results in the following errorLooking at Jinja documentation, it looks like both
jinja2.ext.autoescape
andjinja2.ext.with_
extensions were removed in Jinja 2.9, as they are now built-in: https://jinja.palletsprojects.com/en/3.1.x/extensions/#with-statement https://jinja.palletsprojects.com/en/3.1.x/extensions/#autoescape-extensionIn fact, removing
extensions=jinja2.ext.autoescape,jinja2.ext.with_
line frombabel.cfg
fixes text extraction