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

Grow fails to extract #1183

Open
luisvillalba opened this issue Oct 7, 2021 · 3 comments
Open

Grow fails to extract #1183

luisvillalba opened this issue Oct 7, 2021 · 3 comments

Comments

@luisvillalba
Copy link

When Jinja2 filters are not in the root of the extensions directory, grow fails to import them on the translation extract process. I've attached a reproduction case. Grow run and build work as expected, this only happens with grow translations extract --localized.

This is the error I get:

File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/bin/grow", line 33, in <module>
    sys.exit(load_entry_point('grow', 'console_scripts', 'grow')())
File "/home/code/grow/grow/cli.py", line 21, in main
  group.grow.main(args=args, prog_name=name)
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/click/core.py", line 782, in main
  rv = self.invoke(ctx)
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
  return ctx.invoke(self.callback, **ctx.params)
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/click/core.py", line 610, in invoke
  return callback(*args, **kwargs)
File "/home/code/grow/grow/commands/subcommands/translations_extract.py", line 62, in translations_extract
  catalogs.extract(include_obsolete=include_obsolete, localized=localized,
File "/home/code/grow/grow/translations/catalog_holder.py", line 460, in extract
  _babel_extract(f, self.pod.list_locales(), pod_path)
File "/home/code/grow/grow/translations/catalog_holder.py", line 298, in _babel_extract
  for parts in all_parts:
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/babel/messages/extract.py", line 325, in extract
  for lineno, funcname, messages, comments in results:
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/jinja2/ext.py", line 652, in babel_extract
  extensions.add(import_string(extension))
File "/home/.local/share/virtualenvs/extract-bug-vbXN9orH/lib/python3.8/site-packages/jinja2/utils.py", line 131, in import_string
  return getattr(__import__(module, None, None, [obj]), obj)
ModuleNotFoundError: No module named 'filters'

This happens on grow 1+ and grow 2+. It doesn't happen on 0.x.

reproduction-case.zip

@jeremydw
Copy link
Member

Hi Luis - thanks for sending the test case. I played with the test case a bit and found that if you move files from /ext/utils/ to just /ext/ things will work correctly. I will follow up here if there's something further that can be done either within the test case or within Grow to resolve things.

@luisvillalba
Copy link
Author

Yes, I noticed that's the issue, however it only fails for the grow translations extract command, the rest seems to work as expected.

@jeremydw
Copy link
Member

Will try to have an update on this, this week

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