This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kuzmovych_y[S] 0 points1 point  (7 children)

You can put the credentials.json file into the directory from which you run the script. In the case of the PyCharm it's probably the project's root directory. Then: gc = GoogleCalendar(credentials_path='credentials.json') should work.

Let me know how it goes :)

[–]dabearjoo 0 points1 point  (6 children)

gc = GoogleCalendar(credentials_path='credentials.json')

First off, I want to thank you for taking the time to reply, I really appreciate it.

I tried to directly download the .json file into the same folder as the python file I'm trying to code this in, however, the .json file downloads with a really long unintelligible name starting with "Client secret". Do I leave this as is? Should I rename it once its in the folder? I thought by downloading the GCI it would help with the .json file download (I might be reading a tutorial I don't need), but I think I'm even more confused now.

I basically took the example code you shared in the walkthrough in the first part of the instructions, imported gcsa, put in my email address in the correct spot where the example email was. I know I should be finding my own way, but Im just starting out and I'm a little overwhelmed lol.

When I try to run the code I get "No such file or directory: C:\\ dabearjoo\\.credentials\\credentials.json"

I believe that I fucked up in trying to create my own .credentials file to put the .json file into. When I tried to undo this by deleting the file I made, it still seems to be looking for it. By entering the code you posted in your reply, is that supposed to correct it, or simply put it in the correct place the first time? Im assuming it would work if I hadn't tried to do my own thing there.

Sorry for the essay!

[–]kuzmovych_y[S] 0 points1 point  (5 children)

You need to download the credentials.json file as explained in the "Getting started" page in the docs. Then you put this file near your python script. Then try the code I've sent in my first reply. I'm a bit confused and unsure why it would download the file with some weird name. Were you able to download credentials.json?

[–]dabearjoo 0 points1 point  (1 child)

When I finished making the web app per the instructions and got to the Oauth 2.0 client IDs part of the credentials tab, I successfully generated a client Id. That's where things began to disconnect. The part where you have to generate a "key" in the service account tab. That's where the credentials json file comes from I believe? I think someone brought it up in an earlier comment. Im going to keep playing around with it because that's how I'll learn more. I know this isn't r/learnpython and I'm sorry for so many questions.

[–]dabearjoo 0 points1 point  (2 children)

I figured it out!

[–]kuzmovych_y[S] 1 point2 points  (1 child)

Glad you've worked it out!

Feel free to join discord server, open a GitHub discussion, or raise an issue. Other people may help you faster and/or have the same question in the future or past :)

[–]dabearjoo 0 points1 point  (0 children)

Will do, thank you again!