You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
option --init-missing of pybabel update should also create the corresponding directory #1139
I use the option --init-missing of pybabel update to avoid redundant pybabel init command. However, this option only creates the *.po file, and will fail if the target directory ([locale]/LC_MESSAGES) does not exist yet:
creating catalog .\en_US\LC_MESSAGES\strings.po based on strings.pot
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "...\.venv\Scripts\pybabel.exe\__main__.py", line 8, in<module>
File "...\.venv\Lib\site-packages\babel\messages\frontend.py", line 999, in main
returnCommandLineInterface().run(sys.argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\.venv\Lib\site-packages\babel\messages\frontend.py", line 925, in run
returncmdinst.run()
^^^^^^^^^^^^^
File "...\.venv\Lib\site-packages\babel\messages\frontend.py", line 795, in run
with open(filename, 'wb') as outfile:
^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '.\\en_US\\LC_MESSAGES\\strings.po'
This behavior makes the option less useful. I suggest invoke os.makedirs in UpdateCatalog.finalize_options, just like in InitCatalog.finalize_options:
Activity
akx commentedon Oct 19, 2024
Makes sense! If you feel like writing a PR, that would be appreciated.
du33169 commentedon Oct 22, 2024
I'll look into it, but it will be a few days before I'm free.
If you or anyone else is interested and can nail it, please go ahead.
akx commentedon Jan 13, 2025
Hmm – I'm actually unable to repro this 🤔
du33169 commentedon Jan 13, 2025
It still occurs for me with Babel v2.16.0 and Python 3.11.
Here's what I did:
And the output:
log.txt
Reuse InitCatalog's guts in UpdateCatalog
Reuse InitCatalog's guts in UpdateCatalog
Reuse InitCatalog's guts in UpdateCatalog (#1244)