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

Run extract translations on nau-themes using python 3.11 #62

Open
igobranco opened this issue Jan 7, 2025 · 0 comments
Open

Run extract translations on nau-themes using python 3.11 #62

igobranco opened this issue Jan 7, 2025 · 0 comments
Assignees

Comments

@igobranco
Copy link
Member

igobranco commented Jan 7, 2025

Open edX Redwood is using Python 3.11 has default. But the nau-themes repository still needs to use Python 3.8 to extract underscore template translations. We need to upgrade the dependencies on requirements.txt file to fix it.

extracting messages from edx-platform/nau-basic/lms/templates/schedules/edx_ace/recurringnudge_day3/email/body.html (input_encoding="utf-8")
extracting messages from edx-platform/nau-basic/lms/templates/widgets/cookie-consent.html (input_encoding="utf-8")
writing PO template file to edx-platform/nau-basic/conf/locale/django.pot
pybabel extract -F edx-platform/nau-basic/conf/locale/babel_underscore.cfg -o edx-platform/nau-basic/conf/locale/djangojs.pot [email protected] --copyright-holder=FCT-FCCN -c Translators edx-platform/nau-basic/*
extracting messages from edx-platform/nau-basic/cms/templates/force-translations.underscore (input_encoding="utf-8")
Traceback (most recent call last):
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/bin/pybabel", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/babel/messages/frontend.py", line 929, in main
    return CommandLineInterface().run(sys.argv)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/babel/messages/frontend.py", line 853, in run
    return cmdinst.run()
           ^^^^^^^^^^^^^
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/babel/messages/frontend.py", line 481, in run
    for filename, lineno, message, comments, context in extracted:
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/babel/messages/extract.py", line 149, in extract_from_dir
    for message_tuple in check_and_call_extract_file(
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/babel/messages/extract.py", line 207, in check_and_call_extract_file
    for message_tuple in extract_from_file(
                         ^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/babel/messages/extract.py", line 243, in extract_from_file
    return list(extract(method, fileobj, keywords, comment_tags,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/babel/messages/extract.py", line 297, in extract
    func = getattr(__import__(module, {}, {}, [attrname]), attrname)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/enmerkar_underscore/__init__.py", line 13, in <module>
    from markey import underscore
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/markey/underscore.py", line 50, in <module>
    rule(r"('([^'\\]*(?:\\.[^'\\]*)*)'|"
  File "/home/ubuntu/projects/nau/nau-tutor-configs/repositories/nau-themes/venv/lib/python3.11/site-packages/markey/rules.py", line 31, in __init__
    self.match = re.compile(regexp, re.U).match
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.11.8/lib/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.11.8/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.11.8/lib/python3.11/re/_compiler.py", line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.11.8/lib/python3.11/re/_parser.py", line 989, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.11.8/lib/python3.11/re/_parser.py", line 464, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.11.8/lib/python3.11/re/_parser.py", line 850, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 55
make: *** [Makefile:41: extract_translations] Error 1

Even after upgrading each requirements.txt dependency it raises another error.

@igobranco igobranco assigned igobranco and unassigned igobranco Jan 7, 2025
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

1 participant