Skip to content
Advertisement

Google Cloud Translate API client attribute

I am trying to use the Google Translate API. I’ve installed the required libraries as per their guide and created a virtual environment. However, when running the following sample code which was provided on the website, I keep getting an error regarding the attributes of the library:

JavaScript

Output:

JavaScript

Why am I getting this error?

Advertisement

Answer

Given that a long time has passed with no answer I’ll summarize the answer given within the comments by Christopher and tested by Omar. Posts should have an accepted answer if they are properly solved to give more visibility to the post so other users experiencing a similar issue can find it faster.

The root cause of the issue AttributeError: module 'google.cloud.translate_v2' has no attribute 'Client' was found within the environment itself. Creating a new, fresh, virtual environment and re-installing the dependencies solved the issue.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement