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

Exception: Download failed for English → Spanish

Open amitli1 opened this issue 1 year ago • 2 comments

I'm trying to run the basic example and failed:

import argostranslate.package
import argostranslate.translate

from_code = "en"
to_code   = "es"

# Download and install Argos Translate package
argostranslate.package.update_package_index()
available_packages = argostranslate.package.get_available_packages()
package_to_install = next(
    filter(
        lambda x: x.from_code == from_code and x.to_code == to_code, available_packages
    )
)

argostranslate.package.install_from_path(package_to_install.download())

# Translate
translatedText = argostranslate.translate.translate("Hello World", from_code, to_code)
print(translatedText)

Error:

Exception                                 Traceback (most recent call last)
Cell In[1], line 16
      9 available_packages = argostranslate.package.get_available_packages()
     10 package_to_install = next(
     11     filter(
     12         lambda x: x.from_code == from_code and x.to_code == to_code, available_packages
     13     )
     14 )
---> 16 argostranslate.package.install_from_path(package_to_install.download())
     18 # Translate
     19 translatedText = argostranslate.translate.translate("Hello World", from_code, to_code)

File ~\py310\lib\site-packages\argostranslate\package.py:269, in AvailablePackage.download(self)
    267 data = networking.get_from(self.links)
    268 if data is None:
--> 269     raise Exception(f"Download failed for {str(self)}")
    270 with open(filepath, "wb") as f:
    271     f.write(data)

Exception: Download failed for English → Spanish

I'm using:

  • windows 10
  • python 3.10.0
  • argostranslate==1.8.0

amitli1 avatar May 23 '23 11:05 amitli1

Maybe related to: https://github.com/LibreTranslate/LibreTranslate/issues/441

michaelfeil avatar Jun 28 '23 10:06 michaelfeil

I think the issue is that the Cloudflare download failed for some reason.

PJ-Finlay avatar Jul 04 '23 13:07 PJ-Finlay