Python Forum
Module googletrans 2.4.0 Question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Module googletrans 2.4.0 Question
#1
How to use googletrans for translation.
According to googletrans 2.4.0
I got error even with the official basic code.

from googletrans import Translator
translator = Translator()
translator.translate('안녕하세요.')
# <Translated src=ko dest=en text=Good evening. pronunciation=Good evening.>
translator.translate('안녕하세요.', dest='ja')
# <Translated src=ko dest=ja text=こんにちは。 pronunciation=Kon'nichiwa.>
translator.translate('veritas lux mea', src='la')
# <Translated src=la dest=en text=The truth is my light pronunciation=The truth is my light>
Error:
[Running] python -u "d:\Loading\test\test.py" Traceback (most recent call last): File "d:\Loading\test\test.py", line 3, in <module> translator.translate('\uc548\ub155\ud558\uc138\uc694.') File "C:\Users\myName\Anaconda3\lib\site-packages\googletrans\client.py", line 172, in translate data = self._translate(text, dest, src) File "C:\Users\myName\Anaconda3\lib\site-packages\googletrans\client.py", line 75, in _translate token = self.token_acquirer.do(text) File "C:\Users\myName\Anaconda3\lib\site-packages\googletrans\gtoken.py", line 180, in do self._update() File "C:\Users\myName\Anaconda3\lib\site-packages\googletrans\gtoken.py", line 59, in _update code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', '') AttributeError: 'NoneType' object has no attribute 'group' [Done] exited with code=1 in 0.732 seconds
In addition, if using Array call, will it consider one call or multiple calls? Ref Link
Quote:Advanced Usage (Bulk)
Array can be used to translate a batch of strings in a single method call and a single HTTP session. The exact same method shown above work for arrays as well.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  datetime module question jacksfrustration 10 1,716 Jan-12-2024, 04:54 AM
Last Post: deanhystad
  googletrans library to translate text language for using data frame is not running gcozba2023 0 1,215 Mar-06-2023, 09:50 AM
Last Post: gcozba2023
  Module not found question sighhhh12 0 1,483 Sep-09-2022, 05:43 AM
Last Post: sighhhh12
  [GoogleTrans] How can i print my translation word ?... JamieVanCadsand 7 11,694 Aug-29-2021, 12:01 PM
Last Post: Melcu54
  Question on subprocess module. knoxvilles_joker 3 2,672 Apr-11-2021, 12:51 AM
Last Post: knoxvilles_joker
  keyboard module question DPaul 0 2,125 Mar-23-2021, 04:22 PM
Last Post: DPaul
  Question about the Random Module Exsul 1 1,987 Mar-13-2019, 02:06 AM
Last Post: ichabod801
  Python Module Question ATXpython 9 9,380 Oct-09-2016, 12:59 AM
Last Post: ATXpython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020