Closed sinoroc closed 4 years ago
I am working on fixes for both Mako and lingua.
This is the trace when Mako is installed but not Babel:
Traceback (most recent call last):
File "/home/user/workspace/project/.tox/develop/bin/pot-create", line 11, in <module>
sys.exit(main())
File "/home/user/workspace/project/.tox/develop/lib/python3.6/site-packages/lingua/extract.py", line 308, in main
register_babel_plugins()
File "/home/user/workspace/project/.tox/develop/lib/python3.6/site-packages/lingua/extractors/babel.py", line 51, in register_babel_plugins
extractor = entry_point.load(require=True)
File "/home/user/workspace/project/.tox/develop/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in load
return self.resolve()
File "/home/user/workspace/project/.tox/develop/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2330, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/user/workspace/project/.tox/develop/lib/python3.6/site-packages/mako/ext/babelplugin.py", line 8, in <module>
from babel.messages.extract import extract_python
ModuleNotFoundError: No module named 'babel'
Fixed by #97
It appears that lingua tries to use Babel message extractors even if Babel is not installed. For example Mako contains custom message extractors for Babel. If Mako is installed but not Babel, lingua recognizes the Mako-for-Babel message extractors, loads them, and finally fails while tryin to use them.
Two things:
See setuptools documentation on "Dynamic Discovery of Services and Plugins" for details.