Skip to content

fix: isolate Tencent TMT import from incompatible SDK - #1178

Open
BetterAndBetterII wants to merge 2 commits into
PDFMathTranslate:mainfrom
BetterAndBetterII:cursor/fix-tencent-tmt-import-4b5e
Open

BetterAndBetterII wants to merge 2 commits into
PDFMathTranslate:mainfrom
BetterAndBetterII:cursor/fix-tencent-tmt-import-4b5e

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Fresh installs pull tencentcloud-sdk-python-tmt 3.1.129, which removed TextTranslateRequest / TextTranslateResponse. pdf2zh/translator.py imported those names at module load, so every engine (including Google) crashed before translation started.

  • Lazy-import the Tencent TMT SDK inside TencentTranslator.__init__ so an incompatible or missing SDK only fails when Tencent is selected.
  • Pin tencentcloud-sdk-python-tmt to >=3.0.1257,<=3.1.121, the last releases that still ship the text-translate models.
  • Regression tests stub the 3.1.129 surface and assert other translators still import.

Fixes #1167

cursoragent and others added 2 commits August 18, 2026 08:09
Add a failing test for PDFMathTranslate#1167: translator.py must still load when
tencentcloud-sdk-python-tmt 3.1.129 has removed TextTranslateRequest,
and the TMT dependency must be pinned to a compatible release.

Co-authored-by: Yuzhong Zhang <BetterAndBetterII@users.noreply.github.com>
Stop loading TextTranslateRequest at translator module import so
incompatible tencentcloud-sdk-python-tmt 3.1.129 no longer breaks
other engines. Pin the dependency to 3.0.1257-3.1.121, the last
releases that still ship the text-translate models.

Co-authored-by: Yuzhong Zhang <BetterAndBetterII@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tencentcloud-sdk-python-tmt unpinned dependency breaks import (TextTranslateRequest removed in 3.1.x)

2 participants