Comments (4)
I'm not sure where the error actually happened. Could you give me some more information such as length of the text, or http response(import logging; logging.setLevel(logging.DEBUG)
).
from py-googletrans.
Hi, i use ipdb for geting this error text.
Response said that Request Entity too large
. Got this error if text size more then 3000 characters
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
In [7]: translator.translate(text[:3500], 'en')
> /home/zaebee/.virtualenvs/ww3/lib/python3.6/site-packages/googletrans/utils.py(52)format_json()
51 import ipdb;ipdb.set_trace()
---> 52 converted = json.loads(text)
53 return converted
ipdb> text
'<!DOCTYPE html>\n<html lang=en>\n <meta charset=utf-8>\n <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">\n <title>Error 413 (Request Entity Too Large)!!1</title>\n <style>\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n </style>\n <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n <p><b>413.</b> <ins>Thatâ\x80\x99s an error.</ins>\n <p>Your client issued a request that was too large.\n <script>\n (function() { var c=function(a,d,b){a=a+"=deleted"+("; path="+d);null!=b&&(a+="; domain="+b);document.cookie=a+"; expires=Thu, 01 Jan 1970 00:00:00 GMT"};var g=function(a){var d=e,b=location.hostname;c(d,a,null);c(d,a,b);for(var f=0;;){f=b.indexOf(".",f+1);if(0>f)break;c(d,a,b.substring(f+1))}};var h;if(4E3<unescape(encodeURI(document.cookie)).length){for(var k=document.cookie.split(";"),l=[],m=0;m<k.length;m++){var n=k[m].match(/^\\s*([^=]+)/);n&&l.push(n[1])}for(var p=0;p<l.length;p++){var e=l[p];g("/");for(var q=location.pathname,r=0;;){r=q.indexOf("/",r+1);if(0>r)break;var t=q.substring(0,r);g(t);g(t+"/")}"/"!=q.charAt(q.length-1)&&(g(q),g(q+"/"))}h=!0}else h=!1;\nh&&setTimeout(function(){if(history.replaceState){var a=location.href;history.replaceState(null,"","/");location.replace(a)}},1E3); })();\n</script>\n <ins>Thatâ\x80\x99s all we know.</ins>\n'
from py-googletrans.
raise JSONDecodeError("Expecting value", s, err.value) from None
trans = Translator()
trans.translate(',,')
or
trans.translate('asdsa\x44\x44asdsa')
from py-googletrans.
@gromov-alar so it looks like it's expected behavior that the text size should be less than 15K, as I mentioned in the README.
from py-googletrans.
Related Issues (20)
- why is the code not working, in this case ? HOT 2
- why it raising an error HOT 3
- result.extra_data['possible-mistakes'] returns error HOT 1
- when i run the demo code, raise a error as following: HOT 3
- googletrans conflict with python-telegram-bot because of httpx package HOT 7
- Delete this Post
- Incorrect Translattion
- Error when translating text HOT 1
- Missing 1 required positional argument: 'client' ERROR
- Dependancy error. when installing for Python 3.11.7 32BIT
- There is an error in translating "cat" into French HOT 1
- If you have httpx dependency relevant issues go to the below project to address your problem HOT 1
- Deprecated project, no longer working, cannot even detect English HOT 1
- AttributeError: 'None type' object has no attribute 'group' HOT 5
- always return the source text! HOT 2
- Outdated httpx version HOT 10
- Different translation result vs Google Trans Website HOT 2
- wrong name
- Error "python setup.py egg_info did not run successfully" while installing googletrans==3.1.0a0
- Current GT language list HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-googletrans.