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 }}
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.
Also, msgcat can't write into the created NamedTemporaryFile, when run with --check.
EgeAk@egelaptop powrap on main 🐍 v3.10.9 in powrap
🕙 15:20:48 ❯ python -m powrap about.po --check
Checking wrapping of po files: 0%| | 0/1 [00:00<?, ?it/s]msgcat: cannot create output file "C:\Users\EgeAk\AppData\Local\Temp\tmp0megkadg": Permission denied
Error processing 'about.po': Command '['msgcat', '-', '-o', 'C:\\Users\\EgeAk\\AppData\\Local\\Temp\\tmp0megkadg']' returned non-zero exit status 1.
Checking wrapping of po files: 100%|█████████████████████████████████████████████████████| 1/1 [00:02<00:00, 2.52s/it]
It also adds whitespace at the top of the first msgid-msgstr pair on every file. (This turns out to be about MSYS msgcat not powrap itself)
# Python Documentation Turkish Translation# Copyright (C) 2001-2023, Python Software Foundation# This file is distributed under the same license as the Python package.-#+#
msgid ""
msgstr ""
I tried this on different installations, different computers, and various shells (Git Bash, PowerShell 5 and 7, cmd). WSL (Ubuntu) seemed to have no problem though.
Any idea why this is happening?
The text was updated successfully, but these errors were encountered:
Investigated a bit. The output of msgcat cannot be written into the temporary file created with tempfile.NamedTemporaryFile. I think it is directly related to "Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows)." statement in the tempfile documentation. I will open a PR if I come up with a cross-platform alternative or a workaround. (This comment is about running the command with --check)
About certain files not being accepted: I think it is because of the po_files argument's type definition. Path.read_text() raises UnicodeDecodeError on those files. Simply changing the type=path to type=Path resolves the issue. Or we can add an extra exception handler for UnicodeDecodeError for the path function to ignore this specific exception. Passing encoding = "utf-8" to Path.read_text() also works.
egeakman
changed the title
Powrap doesn't wrap certain files and adds whitespace on Windows
powrap doesn't accept files containing undecodable characters
Feb 16, 2023
When I try to wrap c-api/stable.po, library/decimal.po, howto/unicode.po, etc. it throws:
Also,
msgcat
can't write into the created NamedTemporaryFile, when run with--check
.It also adds whitespace at the top of the first msgid-msgstr pair on every file.(This turns out to be about MSYSmsgcat
not powrap itself)I tried this on different installations, different computers, and various shells (Git Bash, PowerShell 5 and 7, cmd). WSL (Ubuntu) seemed to have no problem though.
Any idea why this is happening?
The text was updated successfully, but these errors were encountered: