beginners-pytorch-deep-learning icon indicating copy to clipboard operation
beginners-pytorch-deep-learning copied to clipboard

problem with googletrans and 'the cat sat on the mat'

Open franzko03 opened this issue 4 years ago • 2 comments

after installing with 'pip install googletrans' to the anaconda env for pytorch the line: sentences = ['The cat sat on the mat'] translations_fr = translator.translate(sentences, dest='fr')

throws an error: File "myuser\anaconda3\envs\PyTc\lib\site-packages\googletrans\gtoken.py", line 62, in _update code = self.RE_TKK.search(r.text).group(1).replace('var ', '')

AttributeError: 'NoneType' object has no attribute 'group'

how can i make this nice tool work?!

franzko03 avatar Feb 26 '21 19:02 franzko03

That error is currently under review, see the package's open issue. I'll open a PR.

--> Please try googletrans==3.1.0a0 instead. It's a temporary fix, but its effectiveness seems to depend on your local environment. Feedback is welcome!

MarcusFra avatar Mar 29 '21 11:03 MarcusFra

I haven't tried nor tested it, but I've also encountered an alternative (for non-commmercial usage) called google_trans_new: https://github.com/lushan88a/google_trans_new

MarcusFra avatar Mar 29 '21 11:03 MarcusFra