2015-04-16 36 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

相關問題