language_tool_python
language_tool_python copied to clipboard
Initial download is extremely slow and times out in IDLE
When run in IDLE for the first time (at least on Windows), the tool floods the IDLE shell with thousands of download progress messages and gradually grind to a halt until it reaches several bytes per second and eventually fails.
It works flawlessly in cmd/terminal, but it would be nice if it worked correctly in IDLE as well. I realize that IDLE has a lot of issues and may or may not be worth fully supporting, but currently there's not even any indication to the user about what the problem is.
Possibly related: https://stackoverflow.com/questions/21198857/python-multiprocessing-example-not-working/
Thanks for letting me know. I think this is the related issue: https://stackoverflow.com/questions/35895864/what-is-the-difference-between-cmd-and-idle-when-using-tqdm/35900117#35900117
But that's just about the progress bar. The command shouldn't fail. @Pikamander2 can you post the error message if there is one?
@jxmorris12 - Just tested it on a different setup (Windows 7 + IDLE 3.8.9 whereas last time I used Windows 10 + IDLE 3.9.0) and the exact same thing happened. The download rate starts out at a reasonable value but then rapidly deteriorates down to a few KB/s and eventually just a few bytes per second. After about 10-20 minutes, it finally fails with a zipfile.BadZipFile error:
Unzipping C:\Users\MyUser\AppData\Local\Temp\tmpl84l608i.zip to C:\Users\MyUser\.cache\language_tool_python.
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
tool = language_tool_python.LanguageTool('en-US')
File "C:\Program Files\Python38\lib\site-packages\language_tool_python\server.py", line 62, in __init__
self._start_server_on_free_port()
File "C:\Program Files\Python38\lib\site-packages\language_tool_python\server.py", line 238, in _start_server_on_free_port
self._start_local_server()
File "C:\Program Files\Python38\lib\site-packages\language_tool_python\server.py", line 248, in _start_local_server
download_lt()
File "C:\Program Files\Python38\lib\site-packages\language_tool_python\download_lt.py", line 154, in download_lt
download_zip(language_tool_download_url, download_folder)
File "C:\Program Files\Python38\lib\site-packages\language_tool_python\download_lt.py", line 129, in download_zip
unzip_file(downloaded_file, directory)
File "C:\Program Files\Python38\lib\site-packages\language_tool_python\download_lt.py", line 117, in unzip_file
with zipfile.ZipFile(temp_file.name, 'r') as zip_ref:
File "C:\Program Files\Python38\lib\zipfile.py", line 1269, in __init__
self._RealGetContents()
File "C:\Program Files\Python38\lib\zipfile.py", line 1336, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
Screenshots of the gradually slowing download rate and messy output: https://imgur.com/a/e5uK0YQ
Here's the code I used:
Command line:
pip install language-tool-python
IDLE:
import language_tool_python
tool = language_tool_python.LanguageTool('en-US')
The issue should be reproducible on any Windows + IDLE setup in which the LanguageTool files have not yet been downloaded.