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

'NoneType' object is not iterable #2

Open
sachin-suresh-rapyuta opened this issue Oct 28, 2022 · 3 comments
Open

'NoneType' object is not iterable #2

sachin-suresh-rapyuta opened this issue Oct 28, 2022 · 3 comments

Comments

@sachin-suresh-rapyuta
Copy link

On running the run.sh script, I get the below error trace:

...
...
Translated 55% of the lines.
Translated 56% of the lines.
Translated 57% of the lines.
Translated 58% of the lines.
Traceback (most recent call last):
  File "/home/sachin/Workspace/Sootballs/Translation_script/translate-po-recursive-src-dest/translate_script.py", line 7, in <module>
    run(
  File "/home/sachin/Workspace/Sootballs/Translation_script/translate-po-recursive-src-dest/translate_po/main.py", line 61, in run
    solve(os.path.join(arguments.dest, relative_path, file), os.path.join(root, file), arguments)
  File "/home/sachin/Workspace/Sootballs/Translation_script/translate-po-recursive-src-dest/translate_po/main.py", line 27, in solve
    line.msgstr = polib.unescape(translate(polib.escape(line.msgid), arguments))
  File "/home/sachin/Workspace/Sootballs/Translation_script/translate-po-recursive-src-dest/translate_po/main.py", line 15, in translate
    return translator.translate(source, dest=arguments.to, src=arguments.fro).text
  File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/client.py", line 222, in translate
    translated_parts = list(map(lambda part: TranslatedPart(part[0], part[1] if len(part) >= 2 else []), parsed[1][0][0][5]))
TypeError: 'NoneType' object is not iterable
@sachin-suresh-rapyuta
Copy link
Author

Guess you need to update the client.py with the try block as discussed here. This seems to be working for me after this update. Checking other scenarios too.

@sachin-suresh-rapyuta
Copy link
Author

And this leads to another error:

Traceback (most recent call last):
  File "translate_script.py", line 8, in <module>
    run(
  File "/home/sachin/Workspace/Sootballs/Translation_script/translate-po-recursive-src-dest/translate_po/main.py", line 61, in run
    solve(os.path.join(arguments.dest, relative_path, file), os.path.join(root, file), arguments)
  File "/home/sachin/Workspace/Sootballs/Translation_script/translate-po-recursive-src-dest/translate_po/main.py", line 27, in solve
    line.msgstr = polib.unescape(translate(polib.escape(line.msgid), arguments))
  File "/home/sachin/Workspace/Sootballs/Translation_script/translate-po-recursive-src-dest/translate_po/main.py", line 15, in translate
    return translator.translate(source, dest=arguments.to, src=arguments.fro).text
  File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/client.py", line 225, in translate
    translated_parts = list(map(lambda part: TranslatedPart(part[0], part[1] if len(part) >= 2 else []), parsed[1][0][0][5]))
IndexError: list index out of range

@arkadianriver
Copy link
Owner

I didn’t do anything with the client.py in googletrans, I just needed to install googletrans rc1 on its own outside the other dependencies. Maybe my test content isn’t sufficient? Is your content in an open git repo that I can test?

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

No branches or pull requests

2 participants