Mar-27-2024, 02:41 PM
Hi all, I'm quite new to Python, so please forgive me if this issue can be fixed with the debugger. I don't know how to debug packages installed from remote repositories. If you could point me to a tutorial on how to do that, it would be nice, but that is besides the main question.
I'm trying to use the package lingvoreader, to work on lingvo dictionaries. For that I've installed the said package, and running the main module of it from the command line. But whatever arguments do I provide to the program, it fails with an error that seems to me like it's caused by I/O issues.
To test that the issue is caused by I/O I've installed the same package on another environment. For reference currently the main environment that I use for my experiments is Windows 10, that runs Python 3.12.2. But I've installed another OS on the VirtualBox, that would be Ubuntu 23.10.1-desktop-amd64, with Python 3.11.6, and within that environment the package runs perfectly fine.
To reproduce the issue, you first would need to install the package lingvoreader.
Here's the commands that I've used to install it:
Here's an example of what you can run:
Here's the full output:
I'm trying to use the package lingvoreader, to work on lingvo dictionaries. For that I've installed the said package, and running the main module of it from the command line. But whatever arguments do I provide to the program, it fails with an error that seems to me like it's caused by I/O issues.
To test that the issue is caused by I/O I've installed the same package on another environment. For reference currently the main environment that I use for my experiments is Windows 10, that runs Python 3.12.2. But I've installed another OS on the VirtualBox, that would be Ubuntu 23.10.1-desktop-amd64, with Python 3.11.6, and within that environment the package runs perfectly fine.
To reproduce the issue, you first would need to install the package lingvoreader.
Here's the commands that I've used to install it:
Output:pip install setuptools -U
pip install lingvoreader
Then you can run the main module with any arguments whatsoever, it doesn't matter as long as you use correct syntax. The error is going to be reproduced either way as long as you run the program on Windows. As I've already tried to reproduce the described steps on a fresh install of a virtualized Windows machine.Here's an example of what you can run:
Output:lsdreader --help
There's really no need to provide the program with any dictionaries to work with to reproduce the issue, because the error occurs when the program is trying to print text to console.Here's the full output:
Output:E:\dict\X5>lsdreader --help
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Scripts\lsdreader.exe\__main__.py", line 7, in <module>
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\site-packages\lingvoreader\lsdreader.py", line 128, in main
args = get_arg_parser().parse_args()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 1891, in parse_args
args, argv = self.parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 1924, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 2136, in _parse_known_args
start_index = consume_optional(start_index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 2076, in consume_optional
take_action(action, args, option_string)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 2000, in take_action
action(self, namespace, argument_values, option_string)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 1141, in __call__
parser.print_help()
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 2626, in print_help
self._print_message(self.format_help(), file)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python312\Lib\argparse.py", line 2632, in _print_message
file.write(message)
File "<frozen codecs>", line 378, in write
TypeError: write() argument must be str, not bytes
And for comparison, here's what the output looks like on Ubuntu VM:Output:vmadmin@vmadmin-1-2:~$ ~/.local/bin/python -m lingvoreader.lsdreader --help
usage: lsdreader.py [-h] (-i INPUT | -a) [--header] [-o OUTDIR] [-c] [-v]
[--version]
Decode Lingvo lsd dictionary to dsl
options:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Dictionary to decode
-a, --all All dictionary in current directory
--header Print dictionary header and exit
-o OUTDIR, --outdir OUTDIR
Output directory
-c, --codecs print supported languages and their codes
-v, --verbose
--version show program's version number and exit
Lastly, I will provide you with the steps that I took to install the same package on Ubuntu:Output:sudo apt install python3.11-venv
python3 -m venv ~/.local --system-site-packages
~/.local/bin/pip install setuptools -U
~/.local/bin/pip install lingvoreader
To recap, the question is, why does this issue occur on Windows, and not on Linux, and how do I fix it?