Answer the question
In order to leave comments, you need to log in
Why is the pybabel command throwing an error?
World!
Read Miguel Greenberg's book " Flask Mega Tutorial" while following his instructions. And then I got to chapter 13 about maintaining a site in several languages I18n and L10n
And then I got to the command pybabel extract -F babel.cfg -k _l -o messages.pot .
She does the following:
The pybabel extract command reads the configuration file specified in the -F option and then scans all py and html files in the directories corresponding to the configured sources, starting from the directory specified in the command (the current directory or . in this case.) By default, pybabel will look for _() as a text marker, but I also used the lazy variant which I imported as _l() so I need to tell the search tool about it with the -k _l option. The -o option specifies the name of the output file.
~/microblog$ pybabel extract -F babel.cfg -k _l -o messages.pot .
extracting messages from app/__init__.py
extracting messages from app/email.py
extracting messages from app/errors.py
extracting messages from app/forms.py
extracting messages from app/models.py
extracting messages from app/routes.py
extracting messages from app/templates/404.html (extensions="jinja2.ext.autoescape,jinja2.ext.with_")
Traceback (most recent call last):
File "/home/asla/microblog/venv/bin/pybabel", line 11, in <module>
sys.exit(main())
File "/home/asla/microblog/venv/lib/python3.6/site-packages/babel/messages/frontend.py", line 911, in main
return CommandLineInterface().run(sys.argv)
File "/home/asla/microblog/venv/lib/python3.6/site-packages/babel/messages/frontend.py", line 835, in run
return cmdinst.run()
File "/home/asla/microblog/venv/lib/python3.6/site-packages/babel/messages/frontend.py", line 470, in run
for filename, lineno, message, comments, context in extracted:
File "/home/asla/microblog/venv/lib/python3.6/site-packages/babel/messages/extract.py", line 157, in extract_from_dir
dirpath=absname,
File "/home/asla/microblog/venv/lib/python3.6/site-packages/babel/messages/extract.py", line 212, in check_and_call_extract_file
strip_comment_tags=strip_comment_tags
File "/home/asla/microblog/venv/lib/python3.6/site-packages/babel/messages/extract.py", line 241, in extract_from_file
strip_comment_tags))
File "/home/asla/microblog/venv/lib/python3.6/site-packages/babel/messages/extract.py", line 303, in extract
func = entry_point.load(require=True)
File "/home/asla/microblog/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2228, in load
self.require(*args, **kwargs)
File "/home/asla/microblog/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2245, in require
items = working_set.resolve(reqs, env, installer)
File "/home/asla/microblog/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 808, in resolve
if not req_extras.markers_pass(req):
File "/home/asla/microblog/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 993, in markers_pass
return not req.marker or any(extra_evals) or req.marker.evaluate()
File "/home/asla/microblog/venv/lib/python3.6/site-packages/pkg_resources/_vendor/packaging/markers.py", line 278, in evaluate
return _evaluate_markers(self._markers, current_environment)
File "/home/asla/microblog/venv/lib/python3.6/site-packages/pkg_resources/_vendor/packaging/markers.py", line 203, in _evaluate_markers
lhs_value = _get_env(environment, lhs.value)
File "/home/asla/microblog/venv/lib/python3.6/site-packages/pkg_resources/_vendor/packaging/markers.py", line 185, in _get_env
"{0!r} does not exist in evaluation environment.".format(name)
pkg_resources.extern.packaging.markers.UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.
Answer the question
In order to leave comments, you need to log in
Try updating "pip":
In the original version of this tutorial, you can find Miguel Greenberg's own comment on this error (comment #71):
I believe the error that you have was a bug in pip. You may want to try upgrading the pip that you have in your virtual environment.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question