Closed Ethan-Chen-plus closed 1 year ago
这个应该是网络问题,可以检查一下代理设置或者是用腾讯翻译API试试看
感谢大佬,换了一个conda环境就可以了,原先以为是urllib3的问题,但是urllib3版本都是1.25.11 目前还是没有找到原因,不过另一个conda环境可以翻译了。
确实是网络的问题,已解决,谢谢!
可以再了解一下是怎么解决的吗?因为很多用户都有提出这个问题,我很多时候也不太知道具体是怎么回事要怎么解决
在一个conda环境中,我没有设置好翻译引擎为tencent,因此貌似是访问google翻译没有访问上导致的问题,而另一个环境之前设置过translate_tex --setdefault 设置了参数为tencent
translate_arxiv 2206.01838 The current mathtranslate is latest Start engine google language from en language to zh-CN
arxiv number: 2206.01838
temporary directory C:\Users\25122\AppData\Local\Temp\tmpzhsmq8r2 main tex files found: .\neurips_2022.tex merging .\envs.tex merging .\body/Introduction.tex merging .\body/Preliminaries.tex merging .\body/KnowledgeDistillation.tex merging .\tables/rand-format.tex merging .\tables/zeroshot-pretrained-format.tex merging .\tables/better_teacher_format.tex merging .\body/IMP.tex merging .\tables/structured.tex merging .\tables/unstructured.tex merging .\body/Conclusion.tex merging .\body/appendix.tex merging .\tables/hparam-mnli.tex merging .\tables/hparam-qqp.tex merging .\tables/hparam-qnli.tex merging .\tables/hparam-sst.tex merging .\body/related_work.tex Processing .\neurips_2022 Cache is found It is a full latex document 0%| | 0/76 [00:00<?, ?it/s]Error found in Parapragh 1 Content \maketitle 1%|█ | 1/76 [00:21<26:20, 21.07s/it] Traceback (most recent call last): File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 1317, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1026, in _send_output self.send(msg) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 966, in send self.connect() File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 938, in connect (self.host,self.port), self.timeout, self.source_address) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\socket.py", line 727, in create_connection raise err File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\socket.py", line 716, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\25122\AppData\Local\Programs\Python\Python37\Scripts\translate_arxiv.exe__main__.py", line 7, in
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate_arxiv.py", line 176, in main
raise e
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate_arxiv.py", line 166, in main
success = translate_dir('.', options)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate_arxiv.py", line 91, in translate_dir
translate_single_tex_file(file_path, file_path, options.engine, options.l_from, options.l_to, options.debug, options.nocache)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 265, in translate_single_tex_file
text_final = latex_translator.translate_full_latex(text_original, nocache=nocache)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 237, in translate_full_latex
raise e
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 228, in translate_full_latex
latex_translated_paragraph = self.translate_paragraph_latex(latex_original_paragraph)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 165, in translate_paragraph_latex
latex_translated_paragraph = self.translate_text_in_paragraph_latex_and_leading_brace(latex_original_paragraph)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 160, in translate_text_in_paragraph_latex_and_leading_brace
latex_translated_paragraph = self.translate_text_in_paragraph_latex(latex_original_paragraph)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 137, in translate_text_in_paragraph_latex
result += self._translate_text_in_paragraph_latex(split) + ' ' + sep + ' '
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 120, in _translate_text_in_paragraph_latex
text_translated_paragraph = self.translate_paragraph_text(text_original_paragraph)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 95, in translate_paragraph_text
parts_translated.append(self.translator.translate(part))
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 55, in translate
raise e
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 49, in translate
result = self.try_translate(text)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mathtranslate\translate.py", line 41, in try_translate
return self.translator.translate(text, self.language_to, self.language_from)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\site-packages\mtranslate\core.py", line 80, in translate
raw_data = urllib.request.urlopen(request).read()
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 543, in _open
'_open', req)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\25122\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试 失败。>