2015-04-16 39 views
5

几个月前,我用Python的goslate包将一堆法文文本翻译成英文。当我试图这样做但是,今天,服务返回一个错误:Python:Goslate翻译请求返回“503:服务不可用”

import goslate 
gs = goslate.Goslate() 
print gs.translate('hello world', 'de') 

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "c:\Python27\lib\site-packages\goslate.py", line 389, in translate 
    return _unwrapper_single_element(self._translate_single_text(text, target_language, source_language)) 
    File "c:\Python27\lib\site-packages\goslate.py", line 317, in _translate_single_text 
    results = list(self._execute(make_task(i) for i in split_text(text))) 
    File "c:\Python27\lib\site-packages\goslate.py", line 200, in _execute 
    yield each() 
    File "c:\Python27\lib\site-packages\goslate.py", line 315, in <lambda> 
    return lambda: self._basic_translate(text, target_language, source_lauguage)[0] 
    File "c:\Python27\lib\site-packages\goslate.py", line 241, in _basic_translate 
    response_content = self._open_url(url) 
    File "c:\Python27\lib\site-packages\goslate.py", line 178, in _open_url 
    response = self._opener.open(request, timeout=self._TIMEOUT) 
    File "c:\Python27\lib\urllib2.py", line 437, in open 
    response = meth(req, response) 
    File "c:\Python27\lib\urllib2.py", line 550, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "c:\Python27\lib\urllib2.py", line 469, in error 
    result = self._call_chain(*args) 
    File "c:\Python27\lib\urllib2.py", line 409, in _call_chain 
    result = func(*args) 
    File "c:\Python27\lib\urllib2.py", line 656, in http_error_302 
    return self.parent.open(new, timeout=req.timeout) 
    File "c:\Python27\lib\urllib2.py", line 437, in open 
    response = meth(req, response) 
    File "c:\Python27\lib\urllib2.py", line 550, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "c:\Python27\lib\urllib2.py", line 475, in error 
    return self._call_chain(*args) 
    File "c:\Python27\lib\urllib2.py", line 409, in _call_chain 
    result = func(*args) 
    File "c:\Python27\lib\urllib2.py", line 558, in http_error_default 
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) 
urllib2.HTTPError: HTTP Error 503: Service Unavailable 

有谁知道发生了什么事goslate?如果它消失得无影无踪,那么goslate包是否可以通过API调用将法语翻译成英语?

回答

3

请确保您使用的是最新版本的Goslate,如果没有,请尝试从其repository更新它。本月API发生了一些变化,并已在Goslate中实施。我刚刚在我的应用程序中检查过它,它确实无误地工作。
为了更新Goslate,您可能需要安装Mercurial版本控制系统。
安装水银后,克隆回购与此命令:

hg clone https://bitbucket.org/zhuoqiang/goslate 

,然后从时间更新到这样的时候(你需要在该存储库文件夹的工作):

hg pull -u 
+1

非常感谢!我刚跑过'pip install -U goslate',它把我带到了那里。再次感谢! – duhaime

+0

似乎再次下降。至少它可以被称为不可靠:S – gabn88

+0

@ gabn88该死的男人,该死的。多年来我一直在使用它!我甚至不记得Goslate在这一点上是什么。 – Radu

相关问题