Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/284.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
读取配置参数时出现Python错误_Python_Google Spreadsheet Api_Configparser_Gspread - Fatal编程技术网

读取配置参数时出现Python错误

读取配置参数时出现Python错误,python,google-spreadsheet-api,configparser,gspread,Python,Google Spreadsheet Api,Configparser,Gspread,我正在尝试使用gspread模块阅读谷歌电子表格。我在config.ini中有一些配置参数。我已成功读取除范围参数之外的所有配置 原值: scope = ['https://spreadsheets.google.com/feeds'] 当我通过configparser读取此参数时,它被视为字符串。 我想在OAuth中包含Google电子表格API。若我直接将范围变量放入语句中,它将毫无错误地加载,但我希望通过配置文件读取它 错误:HttpAccessTokenRefreshError:无效\

我正在尝试使用gspread模块阅读谷歌电子表格。我在config.ini中有一些配置参数。我已成功读取除范围参数之外的所有配置

原值:

scope = ['https://spreadsheets.google.com/feeds']
当我通过configparser读取此参数时,它被视为字符串。 我想在OAuth中包含Google电子表格API。若我直接将范围变量放入语句中,它将毫无错误地加载,但我希望通过配置文件读取它

错误:HttpAccessTokenRefreshError:无效\u作用域:['不是有效的访问群体字符串


我通过将字符串转换为列表来尝试解决方案,但没有解决方案。

尝试通过执行以下操作将列表转换为空格分隔的字符串:
“”。加入(范围)
。在您的例子中,一个简单的字符串包含一项,
'https://spreadsheets.google.com/feeds“
OAuth 2.0作用域必须按照标准以这种方式表示:它起作用了。感谢您通过执行以下操作将列表转换为空格分隔的字符串:
”。join(作用域)
。在您的例子中,一个简单的字符串包含一项,
'https://spreadsheets.google.com/feeds“
OAuth 2.0范围必须以这种方式表示,根据标准:它起作用了。谢谢