0

I have got an old version of code to analyze, which uses pip install translator library:

Code goes like this:

from translator.translator import find_values
find_values('qKey', ['title', 'message'], data, translations)

I am having below error executing the same -

ImportError: cannot import name 'find_values' from 'translator.translator'

I thought I could get rid of this error using legacy versions of translators library, but couldn't find the one which is working.

Can someone please help on how to overcome from this situation.

KD01
  • 35
  • 8
  • 1
    Are you sure you're installing the right package from pip? The (translators package)[https://pypi.org/project/translators/#getting-started] is imported as `import translators`, not as `import translator.translator`. Is there a requirements.txt with the project you are analyzing to give some insight into the packages? What version of python was it written for? – nigh_anxiety Apr 04 '23 at 05:02
  • The requirments.txt says this: boto3==1.9.2, botocore==1.12.2, docutils==0.14, jmespath==0.9.3, python-dateutil==2.7.3, s3transfer==0.1.13, six==1.11.0, translator, urllib3==1.23, – KD01 Apr 04 '23 at 11:05
  • And sorry, I have tried pip install translator: https://pypi.org/project/translator/#history – KD01 Apr 04 '23 at 11:08
  • 1
    That translator module hasn't been modified since 2014, and all 9 versions were created in the same 2 day period in December 2014, so I think it was never actually released. The other listed packages suggest this project was developed mid 2019 (the boto packages are from August 2, 2019 at earliest). Is it possible the translator package used was in fact an internally developed package? You may just need to figure out what it was doing (hopefully comments/documentation are good) and translate that into a currently maintained translator module. – nigh_anxiety Apr 04 '23 at 13:01
  • 1
    Thanks, i totally get what you're saying. But too bad, documentation and comments are either doesn't exist for particular code piece are in very poor shape. But your comment gives a little perspective, Thank you. – KD01 Apr 04 '23 at 13:18

0 Answers0