Comments (5)
Hi! Thanks for reporting!
Can you try this patch:
diff --git a/powrap/powrap.py b/powrap/powrap.py
index 17be2f1..d6f515f 100644
--- a/powrap/powrap.py
+++ b/powrap/powrap.py
@@ -48,7 +48,7 @@ def fix_style(po_files, no_wrap=False, quiet=False):
for po_path in tqdm(po_files, desc="Fixing wrapping of po files", disable=quiet):
with open(po_path, encoding="UTF-8") as po_file:
po_content = po_file.read()
- args = ["msgcat", "-", "-o", po_path]
+ args = ["msgcat", "-", "-o", str(po_path)]
if no_wrap:
args[1:1] = ["--no-wrap"]
try:
I think it's more a Python 3.6 issue than a Windows issue (but I'm surprised you have msgcat on windows :p)
from powrap.
Thanks for the quick reply @JulienPalard
I actually didn't install msgcat so it is weird. I did try your patch and it actually "worked" not raising any exception except for these messages:
(venv) C:\Users\yeyeto2788\workspace\python-docs-es>powrap .\library\othergui.po
Error running msgcat - -o library\othergui.po: [WinError 2] The system cannot find the file specified
Fixing wrapping of po files: 0%| | 0/1 [00:00<?, ?it/s]
(venv) C:\Users\yeyeto2788\workspace\python-docs-es>powrap C:\Users\yeyeto2788\workspace\python-docs-es\library\abc.po
Error running msgcat - -o C:\Users\yeyeto2788\workspace\python-docs-es\library\abc.po: [WinError 2] The system cannot find the file specified
Fixing wrapping of po files: 0%|
IMHO this might be somehow expected since I do not have msgcat installed but it is weird having the progress bar stuck on the bottom and the error above the bar.
Seems like the actual error is because when it tries to execute the command and it does not find msgcat, but the .po
file exists and checks are passed on line https://github.com/JulienPalard/powrap/blob/master/powrap/powrap.py#L68
from powrap.
Yes, that's because you don't have msgcat.
Some people and I are sometimes trying to get rid of this dependency, as we know it's not trivial to get msgcat on Windows.
(I'm starting to think having a textwrap
lib in Python implementing https://www.unicode.org/reports/tr14/tr14-45.html would be great.)
Another way to properly indent a .po
file in the meantime would be to use poedit
(open the file whithin poedit, save, close), which itself uses the same algorithm as msgcat
, so it wraps like powrap. The default configuration is the right one (79 chars per line, something like that), yet you may have to check a box like "rewrap even if I did not modified the file" in the settings to encourage it to actually rewrap the file, IIRC it's not by default.
from powrap.
In the meantime, I used the library on Linux based OS on a VM and it worked flawlessly. Thank you very much for your suggestion on using poedit, I'll keep it in mind for the next time.
Do you think https://docs.python.org/3.5/library/textwrap.html does not implement somehow that? If there is anything I can help with just let me know.
I did a quick review of the code and I notice there are still lines belonging to the old dependency of msgcat command execution https://github.com/JulienPalard/powrap/blob/from_msgcat/powrap/powrap.py#L43
from powrap.
Do you think https://docs.python.org/3.5/library/textwrap.html does not implement somehow that? If there is anything I can help with just let me know.
No, that's not the same algorithm. I opened an issue about it: https://bugs.python.org/issue41975
I did a quick review of the code and I notice there are still lines belonging to the old dependency of msgcat command execution https://github.com/JulienPalard/powrap/blob/from_msgcat/powrap/powrap.py#L43
Yes, this is clearly WIP, not working, it's really just the beginning of a proof of concept which does not even really solve the problem: instead of having a dependency on msgcat, we have a dependency on libunistring.
from powrap.
Related Issues (13)
- powrap chokes on non-ascii characters on Windows HOT 1
- Implement an option to wrap only modified paragraphs HOT 1
- powrap doesn't accept files containing undecodable characters HOT 2
- powrap exits status 1 when done what is expected HOT 1
- Return 1 if a file has been modified in a CI environement
- Progress bar when nothing HOT 2
- Keep getting this error HOT 1
- Bad handling of errors HOT 1
- Missing dependency in requirements.in HOT 2
- Remove msgcat dependency HOT 8
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- other directory + `--modified` = "fatal: not a git repository" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powrap.