py-googletranslation icon indicating copy to clipboard operation
py-googletranslation copied to clipboard

ImportError: cannot import name 'TranslatedPart' from 'googletrans.models'

Open OliveS9 opened this issue 3 years ago • 6 comments

Could anyone please fix the following import error when running "from pygoogletranslation import Translator"? Thanks a lot.

"ImportError: cannot import name 'TranslatedPart' from 'googletrans.models' (/usr/local/lib/python3.7/dist-packages/googletrans/models.py)"

OliveS9 avatar Dec 01 '21 15:12 OliveS9

I have the same problem, did you solve that?

memorate avatar Jan 10 '22 02:01 memorate

pip install googletrans==4.0.0-rc1

this can work

memorate avatar Jan 10 '22 02:01 memorate

  1. cd the following path

YOUR PYTHON INSTALL PATH /lib/site-packages/pygoogletranslation/utils.py


  1. comment the code

from googletrans.models import TranslatedPart (about 8th line)


  1. write new import

from pygoogletranslation.models import TranslatedPart


Qu-Dasheng avatar Feb 20 '22 03:02 Qu-Dasheng

  1. cd the following path

YOUR PYTHON INSTALL PATH /lib/site-packages/pygoogletranslation/utils.py

  1. comment the code

from googletrans.models import TranslatedPart (about 8th line)

  1. write new import

from pygoogletranslation.models import TranslatedPart

Thanks! It worked.

aranjan-covanta avatar Mar 16 '22 17:03 aranjan-covanta

This is the error of old import name, and only this.

Due to this, everyone must change to fix his or her code downloaded. This is what the developer should do.

NCBM avatar Aug 06 '22 10:08 NCBM

and, it dups with #26.

NCBM avatar Aug 06 '22 10:08 NCBM