Skip to content
New issue

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

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

Already on GitHub? # to your account

Uncaught error on a simple translation (ver 1.1.1 via pip) #2

Closed
kmoppel opened this issue Jul 17, 2015 · 3 comments
Closed

Uncaught error on a simple translation (ver 1.1.1 via pip) #2

kmoppel opened this issue Jul 17, 2015 · 3 comments

Comments

@kmoppel
Copy link

kmoppel commented Jul 17, 2015

$ translate -s ee ajuvaba
Traceback (most recent call last):
File "/usr/local/bin/translate", line 38, in
main()
File "/usr/local/bin/translate", line 27, in main
result = translator.translate(args.text, dest=args.dest, src=args.src)
File "/usr/local/lib/python3.4/dist-packages/googletrans/translator.py", line 92, in translate
translated = data[0][0][0]
TypeError: 'NoneType' object is not subscriptable

@ssut
Copy link
Owner

ssut commented Jul 17, 2015

As detected language, the language code of estonian is et, not ee.
If you try with et, it may be works.

Anyway, I updated the code to prevent invalid language codes being passed to the function, it would be appreciated when someone is trying to do so. (and it will be applied for next release!)
Thank you for your reporting. :)

@kmoppel
Copy link
Author

kmoppel commented Jul 17, 2015

Nice, thanks for the quick fix!
Hehe yes stumbled on it due to mistyping the language code, but then checked from wikipedia that "ee" is also a valid language code.

@ssut
Copy link
Owner

ssut commented Jul 17, 2015

Ye, I'll consider to add a converter that substitutes for it. Thank you for your information. 👍

ssut added a commit that referenced this issue Jul 17, 2015
ssut added a commit that referenced this issue Jul 17, 2015
ssut added a commit that referenced this issue Jul 17, 2015
@ssut ssut closed this as completed Jul 17, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants