bookfere / Ebook-Translator-Calibre-Plugin

A Calibre plugin to translate ebook into a specified language.
https://translator.bookfere.com
GNU General Public License v3.0
1.65k stars 106 forks source link

[错误报告] PYTHON语法报错 #310

Closed gamegrd closed 4 months ago

gamegrd commented 4 months ago

基础信息

Traceback (most recent call last): File "calibre_plugins.ebook_translator.components.engine", line 67, in translate_text translation = self.translator.translate(text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "calibre_plugins.ebook_translator.engines.microsoft", line 62, in translate 'authorization': 'Bearer %s' % self._get_app_key() ^^^^^^^^^^^^^^^^^^^ File "calibre_plugins.ebook_translator.engines.microsoft", line 53, in _get_app_key app_key = self.get_result(auth_url, method='GET') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "calibre_plugins.ebook_translator.engines.base", line 210, in get_result raise Exception( Exception: Can not parse returned response. Raw data:

Traceback (most recent call last): File "calibre_plugins.ebook_translator.engines.base", line 197, in get_result br.open(request) File "/usr/lib/python3.12/site-packages/mechanize/_mechanize.py", line 257, in open return self._mech_open(url_or_request, data, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/mechanize/_mechanize.py", line 287, in _mech_open response = UserAgentBase.open(self, request, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/mechanize/_opener.py", line 193, in open response = urlopen(self, req, data) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/mechanize/_urllib2_fork.py", line 425, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/mechanize/_urllib2_fork.py", line 414, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/mechanize/_urllib2_fork.py", line 1283, in https_open return self.do_open(conn_factory, req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/mechanize/_urllib2_fork.py", line 1196, in do_open h = http_class(host_port, timeout=req.timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: HTTPSConnection.init() got an unexpected keyword argument 'key_file'

bookfere commented 4 months ago

问题同 #303,这是安装的 Calibre 所依赖的外部 Python 包 mechanize 不兼容 Python 3.12 导致的,把系统中的 mechanize 升级到最新版 v0.4.10 就可以了。或者按照官方说明安装内置 Python 的 Calibre 二进制版本也可以解决此问题。

gamegrd commented 4 months ago

感谢回复,问题已经解决 方法是升级mechanize