py-googletrans
py-googletrans copied to clipboard
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
I am using version 4 , but I got the above error. I am using the following code
from googletrans import Translator
# Create a translator object
translator = Translator()
# Open the input file
with open('poems.txt', 'r') as file:
input_text = file.read()
# Split the input text into smaller chunks (e.g. sentences or paragraphs)
input_chunks = [chunk.strip() for chunk in input_text.split('\n')]
# Translate each chunk
output_chunks = []
for chunk in input_chunks:
output_chunk = translator.translate(chunk, dest='ur').text
output_chunks.append(output_chunk)
# Join the output chunks into a single string
output_text = '\n'.join(output_chunks)
# Open the output file
with open('output.txt', 'w') as file:
file.write(output_text)
I solved this issue with another library (https://github.com/suqingdong/googletranslatepy). I think that this library is dead.
I have the same error and as I see, responses sometimes are really strange, but not empty at all, there are some strange google codes. And I can't understand what's the principle of getting normal response or just "empty", looks like it's on the Google side, but IDK.
I solved this issue with another library (https://github.com/suqingdong/googletranslatepy). I think that this library is dead.
When the token limit exceed, so they give this error.
I have the same error and as I see, responses sometimes are really strange, but not empty at all, there are some strange google codes. And I can't understand what's the principle of getting normal response or just "empty", looks like it's on the Google side, but IDK.
When the token limit exceed so they show this type of behavior.
I solved this issue with another library (https://github.com/suqingdong/googletranslatepy). I think that this library is dead.
Thanks for suggestion.
I solved this issue with another library (https://github.com/suqingdong/googletranslatepy). I think that this library is dead.
Thanks for suggestion.
Do you think it's because of library or should we use some tricky ways to avoid token limitations for all free libraries?
I solved this issue with another library (https://github.com/suqingdong/googletranslatepy). I think that this library is dead.
Thanks for suggestion.
Do you think it's because of library or should we use some tricky ways to avoid token limitations for all free libraries?
Yeah it's token limitations issues. I think at a time the library can translate 1500 token or 5000, but when the length are exceed, they showing this error.
Do you think, the new library also showing this behavior?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
rip
bulk doesn't work anymore, this doesn't work for example: translations = translator.translate(["The quick brown fox"], dest='fr'), google returns [['wrb.fr', 'MkEWBc', None, None, None, [3], 'generic'], ['di', 13], ['af.httprm', 13, '3204246270318709149', 19]]
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
pip install googletrans==3.1.0a0