python2.7 sharepoint(0.4.1):无法遍历大型列表的行(源代码中有错误)

时间:2015-01-29 17:11:37

标签: python sharepoint soap

我尝试使用python-sharepoint软件包(版本0.4.1)从Share Point站点读取数据。如果数据很小,我可以读取数据,但如果数据超过9,000行,则会出现以下错误:

文件" C:\ Python27 \ lib \ site-packages \ sharepoint \ lists__init __。py",第172行,在行中     列表中的行(响应[0] [0] [0]):   文件" lxml.etree.pyx",第1089行,位于lxml.etree._Element。 getitem (src \ lxml \ lxml.etree.c:47648) IndexError:列表索引超出范围

我的代码如下(python2.7,windows 2007,RAM 8GB内存(免费~4GB)):

from sharepoint import SharePointSite
import urllib2
from ntlm import HTTPNtlmAuthHandler

# my Windows credentials
username = "DOMAIN\\username"
password = "Password"

# the sharepoint info
server_url = "https://sharepoint_server.com/"
site_url = server_url + "sites/SharePointPlus"
list_name = 'List with more than 10,000 rows'
FieldName = 'Output Field' 

# an opener for the NTLM authentication
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, server_url, username, password)
auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)
# create and install the opener
opener = urllib2.build_opener(auth_NTLM)
urllib2.install_opener(opener)

# create a SharePointSite object
site = SharePointSite(site_url, opener)
sp_list = site.lists[list_name] 

for row in sp_list.rows:
    print row.id, row.FieldName

因此,当我尝试遍历大列表中的行时,它在最后两行中失败了。当列表很小时,一切都运行得很好。

我查看了源代码sharepoint \ lists__init __。py,它似乎在第171行失败:

response = self.opener.post_soap(LIST_WEBSERVICE, xml) 

xml 看起来不错: http://schemas.microsoft.com/sharepoint/soap/} GetListItems位于0x3279b70> ) 但响应看起来像 http://schemas.xmlsoap.org/soap/envelope/}错误在0x32805d0> 。 对于小数据,响应看起来像 http://schemas.microsoft.com/sharepoint/soap/} GetListItemsResponse at 0x31355f8>

我是python和sharepoint的新手,并会感谢任何帮助和指导(不确定它的代码或硬件,可能是我的电脑不够强大)

感谢。

0 个答案:

没有答案