Closed nemelu closed 1 month ago
I'm having a similar issue.
When testing any translation engine
raceback (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.google", line 53, in translate
return self.get_result(
^^^^^^^^^^^^^^^^
File "calibre_plugins.ebook_translator.engines.base", line 210, in get_result
raise Exception(
Exception: 无法解析返回的响应。原始数据:
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'
The error information indicates that your Calibre is using an external Python library, which may have caused many problems. I suggest you follow the installation instructions provided by Calibre to install a version of Calibre that contains a built-in Python. This may help resolve the issue.
I installed Calibre from the system package manager. I don't want to installed it manually.
The problem is that Python 3.12 deprecated the key_file
parameter in http.client.HTTPSConnection
but the package mechanize
that your plugin depends on is still using it.
So, I guess I will have to wait until they fix that.
Your Calibre is not a self-contained version, so the plugin just depends on the mechanize
package you installed.
From the the issue of mechanize
, this is a bug that exists in versions lower than v0.4.10. Fortunately, the issue has been addressed in version v0.4.10. Therefore, you need to upgrade mechanize
to the latest version to resolve the issue.
Thank you for the clarification. Sorry for wasting your time. Now I just need to wait for the package update.
Basic information Hello, I keep getting this error no matter what book I translate or which translation engine I use.
Describe the bug Every translation job fails and shows this stack trace: