'AttributeError: 'module' object has no attribute 'file'' when using oauth2client with Google Calendar
Asked Answered
E

1

7

I'm using the example script for google calendars python api (https://developers.google.com/google-apps/calendar/quickstart/python#step_3_set_up_the_sample) to try and print out all the calendar events. However I am getting an error of:

AttributeError: 'module' object has no attribute 'file'

from the line

store = oauth2client.file.Storage(credential_path)

I can find no references to such an error in the docs. Has anyone else come across this before?

Cheers, Jack

Effectually answered 3/5, 2016 at 10:50 Comment(1)
Can you add more of your code? The problem may lie in lines of code before that section, namely from the instantiation of the oauth2client object or the credential_path argument.Neddy
P
20

In original sample

https://developers.google.com/google-apps/calendar/quickstart/python#step_3_set_up_the_sample

missing import entry:

   from oauth2client import file 

add this line and try run your script again

Product answered 20/6, 2016 at 20:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.