Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.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 不完全读取错误:I';I’我正在用gspread阅读电子表格_Python_Python 2.7_Httplib_Gspread - Fatal编程技术网

Python 不完全读取错误:I';I’我正在用gspread阅读电子表格

Python 不完全读取错误:I';I’我正在用gspread阅读电子表格,python,python-2.7,httplib,gspread,Python,Python 2.7,Httplib,Gspread,我正在使用get_all_values()函数,它有时会抛出一个错误 content = worksheet.get_all_values() File "/usr/local/lib/python2.7/dist-packages/gspread/models.py", line 339, in get_all_values cells = self._fetch_cells() File "/usr/local/lib/python2.7/dist-packages/gspread/mode

我正在使用get_all_values()函数,它有时会抛出一个错误

content = worksheet.get_all_values()
File "/usr/local/lib/python2.7/dist-packages/gspread/models.py", line 339, in get_all_values
cells = self._fetch_cells()
File "/usr/local/lib/python2.7/dist-packages/gspread/models.py", line 226, in _fetch_cells
feed = self.client.get_cells_feed(self)
File "/usr/local/lib/python2.7/dist-packages/gspread/client.py", line 251, in get_cells_feed
return ElementTree.fromstring(r.read())
File "/usr/lib/python2.7/httplib.py", line 541, in read
return self._read_chunked(amt)
File "/usr/lib/python2.7/httplib.py", line 590, in _read_chunked
value.append(self._safe_read(chunk_left))
File "/usr/lib/python2.7/httplib.py", line 649, in _safe_read
raise IncompleteRead(''.join(s), amt)
IncompleteRead: IncompleteRead(16360 bytes read, 26 more expected)
我不知道为什么这种情况只会发生几次。有人能解释一下所有可能的情况吗?这样我就可以处理这件事了


我在这里读了n条路径,这是否意味着可能是连接问题或其他问题。

我猜这不是实际错误,请包括完整的错误消息和回溯,以及可能产生此错误的代码(特别是在某些时候)@Tadhgmandon Jensen您现在可以检查提取所有值需要多长时间吗?我每天每时每刻都会查询一张工作表,除了OAuth过期之外,Google API还会抛出大量连接错误。你可以尝试使用keep alive连接:@roganjosh:我不是100%确定是否诚实,但我认为值得一试。从错误消息中我可以看出,
gspread
代码已在之后更改。它现在使用
requests
模块处理
GET
请求,并将行
returnelementtree.fromstring(r.read())
更改为
returnelementtree.fromstring(r.content)
。我建议更新到最新版本,看看问题是否仍然存在。如果是这样,
requests
提供一个
raiseforstatus
方法,告诉我们服务器返回的错误。