Doesn't work when folder names consist of whitespace
Opened this issue · 10 comments
Because of utils.py, function parse_mode_file cmd.split just splits by whitespace, so if username, or any folder name consist of space makes an error
One thing I guess would work is enclosing the path in quotes so that it is treated as a single component. But yes it's best to avoid using spaces in user or file names.
Language pairs should install modes.xml so apertium-python doesn't have to parse shell scripts (badly)
I attempted several methods including parsing with shlex, regular expression(re) and using r-string to treat the backslash character () as a literal character, none of them appear to resolve this problem.
It would be a more prudent approach to install language pairs using modes.xml instead of relying on parsing shell scripts. @unhammer I am willing to give it a try. Could you please provide me with some guidance on how to proceed with this? Thanks!
Rightly said, Parsing shell scripts can be slow and error-prone, especially with complex data.
using modes.xml, should determine which language pair to use avoiding the need of parsing.
I also tried several methods but I think we can minimize the parse steps by using Python language as it does single parser testing whereas if we go for C++, C, and Java, two parsers will be tested.
We can add modes.xml
to https://github.com/apertium/apertium/blob/main/apertium.m4#L151 so that all languages and pairs will install it. Or I can force it in the packaging system, though that's less ideal.
+1 to m4
one more thing i think can be done is to use escape character '\' when the folder name consist any whitespace.
one more thing i think can be done is to use escape character '' when the folder name consist any whitespace.
yeah i think that will be a great step in solving the problem.
That's great.......! Give this a try.