5

I get an error with the first line:

except errors.HttpError, error:
   print (f'An error occurred: {error}')
   return None

(The line 2 has been updated for python 3. Only the parenthesis to print are mandatory)

2
  • How to import "errors"?
    – derek
    Sep 23, 2018 at 3:45
  • 2
    @derek try from apiclient import errors, discovery #needed for gmail service
    – JinSnow
    Sep 23, 2018 at 6:41

1 Answer 1

13

You must switch the , with a as:

except errors.HttpError as error:
   print (f'An error occurred: {error}')
   return None
1
  • 1
    Works for me. Thanks.
    – G Gill
    May 15, 2017 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.