Hello, I had an ImportError when extracting the messages of my Django app. The message error was the following one:
from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
ImportError: cannot import name 'TOKEN_TEXT' from 'django.template.base' (c:\users\artac\appdata\local\programs\python\python37-32\lib\site-packages\django\template\base.py)
I managed to solve it by making some changes in the django_babel/extract.py file. Those changes where:
- Changing the line 2 imports to this:
from django.template.base import Lexer, TokenType
- Changing the
extract_django(fileobj, keywords, comment_tags, options) method, replacing every TOKEN_BLOCK to TokenType.BLOCK, TOKEN_TEXT to TokenType.TEXT and TOKEN_VAR to TokenType.VAR.
My package versions are:
- Django==2.1.7
- django-babel==0.6.2
- Babel==2.6.0
Hello, I had an ImportError when extracting the messages of my Django app. The message error was the following one:
I managed to solve it by making some changes in the django_babel/extract.py file. Those changes where:
from django.template.base import Lexer, TokenTypeextract_django(fileobj, keywords, comment_tags, options)method, replacing everyTOKEN_BLOCKtoTokenType.BLOCK,TOKEN_TEXTtoTokenType.TEXTandTOKEN_VARtoTokenType.VAR.My package versions are: