1
我遇到一個問題,即使用gspread從我的pi中訪問谷歌驅動器電子表格。使用下面的代碼 - 我已經移動了Python IDLE來嘗試解決問題。Pi上的GSPREAD:SyntaxError:預期的路徑分隔符([)
>>> import gspread
>>> gc = gspread.login('username', 'password')
>>> spreadsheet=gc.open('Spreadsheet')
>>> Log_sheet = spreadsheet.worksheet("Sheet1")
>>> Log_sheet.acell('B1').value
'Value @ B1'`
我已經使用命令行相同的代碼從我的計算機試圖(選中的版本),它工作正常與上面的結果。我已經更新了版本,我PI
行>>>Log_sheet = spreadsheet.worksheet("Sheet1")
所以我已經登錄並訪問谷歌電子表格後的PI發生錯誤 - 它的訪問工作表 - 它確實存在,我可以從我的電腦訪問。我還發布了一個關於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的,因爲我認爲這可能是我尋找答案的可能性,我也嘗試過蟒蛇3.1的PI,仍然沒有喜悅。
請任何人都可以幫忙嗎?我覺得它很容易,但我沒有看到它
這是一個錯誤;轉到gspread/models.py並改變第168行以讀取'self.version = self._get_link('edit',element).get('href').split('/')[-1]'。或者更新gspread。 – refi64