在使用language_tool_python包查找语法错误时,我发现了以下异常:
Exception: Could not find at URL https://www.languagetool.org/download/LanguageTool-5.5.zip.
我正在使用 Mac M1,必须从 Azul Zulu 安装Java 17(也尝试过 Java 8),这样它才能识别 Java 模块。
在 Linux 上,工作正常。
好像是url有问题,但是我们直接去的时候文件是存在的!
https://www.languagetool.org/download/LanguageTool-5.5.zip
也尝试了 2.5 版,但我得到了相同的结果。
有解决方法吗?
谢谢!
这里的追溯:
Exception Traceback (most recent call last)
/var/folders/d_/hfs18jf54371qfmf54zq289c0000gn/T/ipykernel_33610/1177712971.py in <module>
----> 1 tool = language_tool_python.LanguageTool('en-US')
~/miniforge3/envs/transformers/lib/python3.9/site-packages/language_tool_python/server.py in __init__(self, language, motherTongue, remote_server, newSpellings)
43 self._update_remote_server_config(self._url)
44 elif not self._server_is_alive():
---> 45 self._start_server_on_free_port()
46 if language is None:
47 try:
~/miniforge3/envs/transformers/lib/python3.9/site-packages/language_tool_python/server.py in _start_server_on_free_port(self)
179 self._url = 'http://{}:{}/v2/'.format(self._HOST, self._port)
180 try:
--> 181 self._start_local_server()
182 break
183 except ServerError:
~/miniforge3/envs/transformers/lib/python3.9/site-packages/language_tool_python/server.py in _start_local_server(self)
189 def _start_local_server(self):
190 # Before starting local server, download language tool if needed.
--> 191 download_lt()
192 err = None
193 try:
~/miniforge3/envs/transformers/lib/python3.9/site-packages/language_tool_python/download_lt.py in download_lt(update)
152 return
153
--> 154 download_zip(language_tool_download_url, download_folder)
155
156 if __name__ == '__main__':
~/miniforge3/envs/transformers/lib/python3.9/site-packages/language_tool_python/download_lt.py in download_zip(url, directory)
123 # Download file.
124 downloaded_file = tempfile.NamedTemporaryFile(suffix='.zip', delete=False)
--> 125 http_get(url, downloaded_file)
126 # Close the file so we can extract it.
127 downloaded_file.close()
~/miniforge3/envs/transformers/lib/python3.9/site-packages/language_tool_python/download_lt.py in http_get(url, out_file, proxies)
104 total = int(content_length) if content_length is not None else None
105 if req.status_code == 403: # Not found on AWS
--> 106 raise Exception('Could not find at URL {}.'.format(url))
107 progress = tqdm.tqdm(unit="B", unit_scale=True, total=total, desc='Downloading LanguageTool')
108 for chunk in req.iter_content(chunk_size=1024):
Exception: Could not find at URL https://www.languagetool.org/download/LanguageTool-5.5.zip.```