Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError when running the extraction process #48

Open
antrodart opened this issue Mar 27, 2019 · 1 comment
Open

ImportError when running the extraction process #48

antrodart opened this issue Mar 27, 2019 · 1 comment

Comments

@antrodart
Copy link

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:

  1. Changing the line 2 imports to this: from django.template.base import Lexer, TokenType
  2. 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
@LocutusOfBorg
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants