looker_sdk doesn't find the client

Hi,

I’m trying to connect my python code to my looker account.

I’ve downloaded the looker_sdk.

However, when trying to execute my program I get the error:

ImportError: cannot import name ‘client’ from ‘looker_sdk’.

I was able to execute : sdk = looker_sdk.init31()

python- 3.8.2 ,  looker_sdk = (0.1.3b20)

1 6 876
6 REPLIES 6

Hi @rakeshkumar1,
 

In the older versions of the looker_sdk, clients was one of the modules imported to run functions like the init function. With the latest versions, this is not needed.

import looker_sdk
####Initialize API/SDK for more info go here: https://pypi.org/project/looker-sdk/
from looker_sdk import methods40, models40
sdk = looker_sdk.init40() # or init40() for v4.0 API
me = sdk.me()


OR:

import looker_sdk
from looker_sdk import models
sdk = looker_sdk.init40() # or init40() for v4.0 API
me = sdk.me()

Please let me know if you have any questions. 

Thanks,

Eric

Hi @Eric_Lyons ,

How to resolve this issue. What python version and looker_sdk version i have to go with.

Thanks,

Rakesh

@rakeshkumar1 

That version of the SDK should be OK. Are you specifically trying to import a client module? If so, you can just remove that and try just use import looker_sdk.

Are you using one of our example scripts as a base for the code?

Thanks,

Eric

Hi @Eric_Lyons ,

Yes i was trying to import client module.

I have tried importing looker_sdk and i gets error as well. I have clone my project repository and there in codes it explicity imported methods and codes. 

Regards,

Rakesh

Hi @rakeshkumar1,

Would you be able to share the new error with me, please?

Thanks,

Eric

@Eric_Lyons ,

My import function is like this 

import csvfrom looker_sdk import methods, clientfrom looker_tenant import Tenantfrom looker_embed_group_manager import EmbedGroupManagerfrom looker_embed_folder_manager import EmbedFolderManagerfrom looker_sdk.rtl import api_settings

So when i removed methods and clients. I get error for methods.