Skip to content

Can't find Client attribute for translate  #636

Closed

Description

I get an attribute error while trying to call the Client function on the translate object.
Traceback (most recent call last):
File "exmp.py", line 49, in
translate_client = translate.Client(SECRET_KEY)
AttributeError: 'function' object has no attribute 'Client'

Activity

  1. ghost added on Nov 7, 2016
  2. ghost assigned on Nov 7, 2016
  3. theacodes commented on Nov 7, 2016

    @theacodes
    Contributor

    @jlim13 it seems like you overloaded the definition translate. Do you mind sharing your entire code?

  4. theacodes commented on Nov 7, 2016

    @theacodes
    Contributor

    It's hard to say without seeing all of your code, but likely you had something like this going on:

    from google.cloud import translate
    
    def translate():
       pass

    when you do that, the translate function shadows the translate module.

  5. StarkGang commented on Sep 21, 2020

    @StarkGang

    @kelseyhightower u have explained translate as a func

  6. StarkGang commented on Sep 21, 2020

    @StarkGang

    @theacodes no , he has named translate as function and also imported it
    So it gave error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions