translate-python icon indicating copy to clipboard operation
translate-python copied to clipboard

raise JSONDecodeError("Expecting value", s, err.value) from None

Open ninamculver opened this issue 6 years ago • 6 comments

Attempted to mimic the example and ran into the following error:

from translate import Translator
translator= Translator(to_lang="zh")
translation = translator.translate("This is a pen.")

[Traceback (most recent call last):

File "", line 3, in translation = translator.translate("This is a pen.")

File "C:\ProgramData\Anaconda3\lib\site-packages\translate\translate.py", line 42, in translate return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)

File "C:\ProgramData\Anaconda3\lib\site-packages\translate\translate.py", line 42, in return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)

File "C:\ProgramData\Anaconda3\lib\site-packages\translate\providers\mymemory_translated.py", line 42, in get_translation data = self._make_request(text)

File "C:\ProgramData\Anaconda3\lib\site-packages\translate\providers\mymemory_translated.py", line 39, in _make_request return response.json()

File "C:\ProgramData\Anaconda3\lib\site-packages\requests\models.py", line 896, in json return complexjson.loads(self.text, **kwargs)

File "C:\ProgramData\Anaconda3\lib\json_init_.py", line 348, in loads return _default_decoder.decode(s)

File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end())

File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Expecting value](url)

ninamculver avatar Sep 09 '19 18:09 ninamculver

I'm having the same issue.

timurhamzin avatar Dec 16 '19 06:12 timurhamzin

Hello,

Was anyone able to address it yet? I have the same problem.

Funny thing, the exact same code runs just fine when I use my home laptop. I have tried uninstalling and reinstalling translate, but to no avail.

image

aquaknight avatar Feb 25 '20 06:02 aquaknight

I realized I was getting this error when the API had reached is maximum.

I think it’s an error of you’ve attempted it too many times. I ended up switching the code to use a different package.

Thanks!

On Feb 25, 2020, at 1:05 AM, aquaknight [email protected] wrote:

 Hello,

Was anyone able to address it yet? I have the same problem.

Funny thing, the exact same code runs just fine when I use my home laptop. I have tried uninstalling and reinstalling translate, but to no avail.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ninamculver avatar Feb 25 '20 11:02 ninamculver

@ninamculver Which package? Does that work?

cabhijith avatar Mar 03 '20 12:03 cabhijith

@ninamculver Yeah Buddy! Which package are you talking about?

rish-hyun avatar May 19 '20 17:05 rish-hyun

is this resloved?

Ankush-Nidhi avatar Nov 09 '22 19:11 Ankush-Nidhi