1

我在使用 gspread 从我的 pi 访问谷歌驱动器电子表格时遇到问题。使用以下代码 - 我已移动 python IDLE 以尝试解决问题。

>>> import gspread
>>> gc = gspread.login('username', 'password')
>>> spreadsheet=gc.open('Spreadsheet')
>>> Log_sheet = spreadsheet.worksheet("Sheet1")
>>> Log_sheet.acell('B1').value
'Value @ B1'`

我已经尝试在我的计算机(检查版本)的命令行中使用相同的代码,并且它与上面的结果一起工作正常。我已经更新了我的 pi 上的版本

错误发生在 pi 上,>>>Log_sheet = spreadsheet.worksheet("Sheet1") 所以我已经登录并访问了谷歌电子表格 - 它正在访问工作表 - 它确实存在,我可以从我的计算机访问。我还在 Raspberry Pi 网站上发布了请求帮助。

任何人都可以帮忙吗?这是错误输出。

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.1/dist-packages/gspread/models.py", line 123, in worksheet
self._fetch_sheets()
File "/usr/local/lib/python3.1/dist-packages/gspread/models.py", line 62, in _fetch_sheets
self._sheet_list.append(Worksheet(self, elem))
File "/usr/local/lib/python3.1/dist-packages/gspread/models.py", line 168, in __init__
self.version = element.find(_ns("link[@rel='edit']")).attrib['href'].split('/')[-1]
File "/usr/lib/python3.1/xml/etree/ElementTree.py", line 305, in find
return ElementPath.find(self, path)
File "/usr/lib/python3.1/xml/etree/ElementPath.py", line 186, in find
return _compile(path).find(element)
File "/usr/lib/python3.1/xml/etree/ElementPath.py", line 176, in _compile
p = Path(path)
File "/usr/lib/python3.1/xml/etree/ElementPath.py", line 93, in __init__
"expected path separator (%s)" % (op or tag)
SyntaxError: expected path separator ([)

我也尝试过重新安装 elementtree,因为我看到这可能是我寻找答案的可能性,我也在 pi 上尝试过 python 3.1,仍然没有乐趣。

请问有人可以帮忙吗?我认为这很容易,但我没有看到

4

1 回答 1

0

它与 gspread 本身中 ElementTree API 的不兼容使用有关,它已在0.1.0中修复

于 2013-07-08T23:02:57.203 回答