Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"IndexError: list index out of range" at get_language_map #26

Closed
Senjar opened this issue Oct 30, 2020 · 4 comments
Closed

"IndexError: list index out of range" at get_language_map #26

Senjar opened this issue Oct 30, 2020 · 4 comments

Comments

@Senjar
Copy link

Senjar commented Oct 30, 2020

I keep getting this error. Sometimes it works but 90% of the time I get this.

File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\translators\apis.py", line 964, in <lambda>
    repl = lambda x: translator(query_text=x.group(1).strip(), **translator_params) if x.group(1).strip() else ''
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\translators\apis.py", line 248, in google_api
    self.language_map = self.get_language_map(host_html)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\translators\apis.py", line 216, in get_language_map
    lang_list_str = re.findall("source_code_name:\[(.*?)\],", host_html)[0]
IndexError: list index out of range

I think it also happens when trying to find tkk ( tkk = re.findall("tkk:'(.*?)'", host_html)[0] )

@longway4ml
Copy link

longway4ml commented Nov 2, 2020

I got the same error too.

trans = translators.google(sent, self.language['src'], self.language['dest'], sleep_seconds=0.1)
File "\anaconda2\envs\python3\lib\site-packages\translators\apis.py", line 248, in google_api
self.language_map = self.get_language_map(host_html)
File "\envs\python3\lib\site-packages\translators\apis.py", line 216, in get_language_map
lang_list_str = re.findall("source_code_name:[(.*?)],", host_html)[0]
IndexError: list index out of range

@UlionTse
Copy link
Owner

UlionTse commented Nov 3, 2020

@Senjar @longway4ml Please upgrade it to v4.7.6

@Senjar
Copy link
Author

Senjar commented Nov 3, 2020

I think it's fixed now

@vlasvlasvlas
Copy link

vlasvlasvlas commented Apr 6, 2022

still having this issue, i just downloaded with pip install
imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants