Hello all,
A few days ago, I deployed a Language Translator app.
The Language Translator app was going fine those days. When I checked this morning, It is showing a json.JSONDecode error.
ERROR:
json.decoder.JSONDecodeError: Extra data: line 1 column 798 (char 797)
Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py”, line 338, in _run_script
exec(code, module.dict)
File “/app/languagetranslator/main.py”, line 35, in
translate = translator.translate(text,lang_src=value1,lang_tgt=value2)
File “/home/appuser/venv/lib/python3.7/site-packages/google_trans_new/google_trans_new.py”, line 188, in translate
raise e
File “/home/appuser/venv/lib/python3.7/site-packages/google_trans_new/google_trans_new.py”, line 152, in translate
response = json.loads(response)
File “/usr/local/lib/python3.7/json/init.py”, line 348, in loads
return _default_decoder.decode(s)
File “/usr/local/lib/python3.7/json/decoder.py”, line 340, in decode
raise JSONDecodeError(“Extra data”, s, end)
Github repo: GitHub - harisankarsnair/LanguageTranslator: A web app for translating from one language to another.Almost all languages are available.App also generates an audio file of the translation and lets you download the audio file.
Live App: https://share.streamlit.io/harisankarsnair/languagetranslator/main/main.py
I don’t know why this JSON error is being shown up suddenly.
Can anyone help me solve this problem?
Any help will be much appreciated.
Regards,
Harisankar.
Hey @HarisankarSNair,
Were you able to figure this out? It seems your app is up now and not displaying that JSON error.
Happy Streamlit-ing!
Marisa
1 Like
Hi all,
It is coming from a JSON issue at google_trans_new.py. I fixed at my local by making some changes at this file. For further information to fix at your local you may read this article. Its working properly on local: Python google-trans-new translate raises error: JSONDecodeError: Extra data: - Stack Overflow
But I could not find a way to work this on Streamlit host. Could somebody fix this issue?
Kind Regards,
Cagdas
1 Like
Hi @ekimdusu
Thank you for your reply. I will surely look into this.
Can you share a snippet of the code where you made changes?
I have also created a GitHub issue in my repo mentioning the same -Translating gives error · Issue #1 · HarisankarSNair/LanguageTranslator · GitHub
Regards
Harisankar
1 Like
Hi @Tulasi_Agina,
I can’t help you as it seems that your github repo and app are private. If you can allow me access to them I can take a look and see if I can help find the error.
Happy Streamlit-ing!
Marisa