Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch translation is not working in 4.0.0rc1 #410

Closed
2 of 6 tasks
ViktorooReps opened this issue Aug 13, 2024 · 2 comments
Closed
2 of 6 tasks

Batch translation is not working in 4.0.0rc1 #410

ViktorooReps opened this issue Aug 13, 2024 · 2 comments

Comments

@ViktorooReps
Copy link

Googletrans version:

  • 4.0.0rc1
  • 3.1.0a0
  • 3.0.0
  • 2.x

I'm submitting a ...

  • bug report
  • feature request

Current behavior:

Batch translation does not work.

>>> import googletrans
>>> tr = googletrans.Translator()
>>> tr.translate('test', dest='en')
<googletrans.models.Translated object at 0x101c9c5d0>
>>> tr.translate(['test'], dest='en')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Viktor/PycharmProjects/people-benchmark/.venv/lib/python3.11/site-packages/googletrans/client.py", line 219, in translate
    parsed = json.loads(data[0][2])
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

Other information:

 % pip freeze
annotated-types==0.7.0
anyio==4.4.0
certifi==2024.7.4
chardet==3.0.4
distro==1.9.0
dnspython==2.6.1
email_validator==2.2.0
Faker==26.3.0
googletrans==4.0.0rc1
h11==0.9.0
h2==3.2.0
hpack==3.0.0
hstspreload==2024.8.1
httpcore==0.9.1
httpx==0.13.3
hyper==0.5.0
hyperframe==5.2.0
idna==2.10
jiter==0.5.0
openai==1.40.3
pydantic==2.8.2
pydantic_core==2.20.1
python-dateutil==2.9.0.post0
rfc3986==1.5.0
six==1.16.0
sniffio==1.3.1
tqdm==4.66.5
typing_extensions==4.12.2
@ViktorooReps
Copy link
Author

Temporary fix: downgrade to 3.1.0a0:

>>> from googletrans import Translator
>>> Translator().translate('test', dest='en')
<googletrans.models.Translated object at 0x106d17d90>
>>> Translator().translate(['test'], dest='en')
[<googletrans.models.Translated object at 0x106d39e90>]
>>> 

@ssut
Copy link
Owner

ssut commented Aug 27, 2024

I apologize for not updating this project. As I'm planning to get back, here’s my detailed plan: Issue #411.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants