[Maya2018][Python] Online Access to GoogleSheet - RESOLVED

python
maya

#1

hi!

Made some research which lead to :

But using the sample script from Maya gives nothing…

Executing main() or get_Credentials() always give the following error :

Error: InvalidClientSecretsError: file C:\Program Files\Autodesk\Maya2018\plug-ins\MASH\scripts\oauth2client\clientsecrets.py line 125: Error opening file

Did someone already try something around this?
Would be super helpful,

Thank you! :slight_smile:


#2

From looking at the script, my guess is that it can’t find the credential’s file / folder.
Try going to c:/Users/<user-name>, and adding a .credentials folder.


#3

I actually have no idea where the .credentials folder could be. I haven’t found any… O_o…


#4

If you are on windows, and your windows username is say sama.van, try creating a .credentials folder in C:/Users/sama.van, so that the full path would be C:/Users/sama.van/.credentials.

I don’t know if this will actually help, but that appears to be where the code is looking by default.


#5

It appears I also have the following error :

# UserWarning: Cannot access C:/Users/thomas/Documents\.credentials\sheets.googleapis.com-python-quickstart.json: No such file or directory, at line 255, in "C:\Program Files\Autodesk\Maya2018\plug-ins\MASH\scripts\oauth2client\_helpers.py"

I made a .credential in the Documents folder as mentioned (also into the Users and Users/myName) but nothing to do.
It is actually also looking for a file called sheets.googleapis.com-python-quickstart.json which I have no idea where it should come from…

As the quickstart page mentions I made a client_secret.json which I drop in the same folder as the quickstart.py script. Also Installed the Google Client Lib with the command mentioned which worked a charm.

Really no success to run the script and always the same issues.
Using Python27…

:frowning:

From 3dsmax 2017 it is worse, it can’t even load the quickstart.py script, and can’t find most of the headers. (at least Maya 2018 loads it without error).


#6

Also since the client_secret.json file is the only *.json file they mentioned, I tried to rename it “sheets.googleapis.com-python-quickstart.json” then drop it in the .credentials folder and getting another error :

# Error: KeyError: file C:\Program Files\Autodesk\Maya2018\plug-ins\MASH\scripts\oauth2client\client.py line 302: _module # 

… which gives actually some progress but… no idea if that is really the file it was looking for 1st then why now an error from the key (which seems to be correct in view o the Credentials section.

EDIT : I guess someone else tried this and it was a bad idea :smiley:


#7

Finally got something to work.

It seems the following line has to be edited with local path to the json file :
CLIENT_SECRET_FILE = 'client_secret.json'

Something as the following works :
CLIENT_SECRET_FILE = "G:/samavan-3dtools/python/Google/client_secret.json'

Finally in a more fashion way if you drop the client_secret.json in the same folder as your script :
CLIENT_SECRET_FILE = os.path.dirname(os.path.realpath(__file__)) + "\\" + 'client_secret.json'

It will pop a web browser, ask for login while Maya is completely frozen.
Once logged and the datas arrived, Maya unfreeze then release the print.

Following screenshot
from Maya.

Cheers! :slight_smile:


#8

Awesome, glad you were able to get that working!


#9

Now from 3dsmax 2017 it is a complete failure…
It can’t even load the headers files :slight_smile:

… but anyway not a priority now, 3dsmax team can wait as always :smiley: :smiley: :smiley: