Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Python3使用gmail api tuto时出错;除errors.HttpError外,error:";_Python_Python 3.x_Gmail Api - Fatal编程技术网

使用Python3使用gmail api tuto时出错;除errors.HttpError外,error:";

使用Python3使用gmail api tuto时出错;除errors.HttpError外,error:";,python,python-3.x,gmail-api,Python,Python 3.x,Gmail Api,第一行出现错误: except errors.HttpError, error: print (f'An error occurred: {error}') return None (第2行已针对python 3进行了更新。只有要打印的括号是必需的)您必须将,与切换为: except errors.HttpError as error: print (f'An error occurred: {error}') return None 对我有用。谢谢。如何导入“错误”

第一行出现错误:

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

(第2行已针对python 3进行了更新。只有要打印的括号是必需的)

您必须将
切换为

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

对我有用。谢谢。如何导入“错误”?@derek try
从apiclient导入错误,gmail服务需要的发现