例外:在 URL https://www.languagetool.org/download/LanguageTool-5.5.zip 上找不到。语言工具python,Mac M1

Posted

技术标签:

【中文标题】例外:在 URL https://www.languagetool.org/download/LanguageTool-5.5.zip 上找不到。语言工具python,Mac M1【英文标题】:Exception: Could not find at URL https://www.languagetool.org/download/LanguageTool-5.5.zip. language_tool_python, Mac M1 【发布时间】:2022-01-05 21:55:33 【问题描述】:

使用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.```

【问题讨论】:

zip 后面的点是否需要? https://www.languagetool.org/download/LanguageTool-5.5.zip. 也返回 404 错误。 该问题已在Github 中报告,但现在似乎已解决。你还在面对这个问题吗? @AlexRudenko 我也尝试上去.../download,但得到了同样的错误 403。 @jccampanero 我刚试过req = requests.get('https://www.languagetool.org/download/LanguageTool-5.5.zip',stream=True, proxies=None)得到&lt;Response [403]&gt; 重定向是针对https://languagetool.org/download/LanguageTool-5.5.zip 执行的。注意网址,它不在www 下。而且这个链接总是返回403,禁止。 【参考方案1】:

不是答案:网络流量

在浏览器、开发工具、网络中:zip 上的重定向, 其余的跟踪。

Name Status Type Initiator Size Time
collect?v=1&_v=j96&a=421817770&t=event&_s=2&dl=htt…-languagetool-org-download-languaget&z=2037529220 200 xhr analytics.js:44 22 B 211 ms
Pingym?gm0=0&gm1=0&tivt=2549&hov=1&tth=113&intt=2&intl…0:tp=1:mt=7&sek=3697285284406464539:1638139533389 200 ping inside.js:1 1.3 kB 324 ms
Bilddt?advEntityId=819590&asId=ecf354bb-1855-2567-a204…13*,rmeas:1,rend:1,renddet:DIV.qs.sn,lt:0%7D&br=c 200 gif dcmads.js:1011 216 B 1.08 s
Document LanguageTool-5.5.zip 301 document / redirect others 300 B 295 ms
XHRcollect?t=dc&aip=1&_r=3&v=1&_v=j96&tid=UA-10824261…7377033.1638135822&_u=SCCACEABBAAAAC~&z=905256628 200 xhr analytics.js:44 22 B 195 ms
Document LanguageTool-5.5.zip 200 document LanguageTool-5.5.zip 11.0 kB 494 ms

不确定重定向是否导致问题。

【讨论】:

以上是关于例外:在 URL https://www.languagetool.org/download/LanguageTool-5.5.zip 上找不到。语言工具python,Mac M1的主要内容,如果未能解决你的问题,请参考以下文章

例外:在 URL https://www.languagetool.org/download/LanguageTool-5.5.zip 上找不到。语言工具python,Mac M1

00_Rust安装及Hello World

发布到朋友墙例外

ajax缓存机制

IntelliJ IDEA scala的源码设置

Spark集群搭建