在Google App Engine中,我正在尝试获取特定的记录和与其相关的内容。我使用以下(相关)代码(导入所有必要的GData并对客户端进行身份验证):
sclient = gdata.spreadsheet.text_db.DatabaseClient(username, password)
gdata.alt.appengine.run_on_appengine(sclient)
gdata.alt.appengine.run_on_appengine(sclient._GetDocsClient())
gdata.alt.appengine.run_on_appengine(sclient._GetSpreadsheetsClient())
ss = sclient.GetDatabases(spreadsheet_key="0AqKqcvXam_kcdFlfckZfVzRiaVpRelp2T1FsVl9rRHc")
processedSheet = ss[0].GetTables(worksheet_id=1)
targetTotals = processedSheet[0].GetRecord(row_number=1)
total1 = targetTotals.content["votea"]问题出在最后一行。它抛出这个错误:
AttributeError: 'NoneType' object has no attribute 'content'我查看了GData电子表格text_db模块的源代码,返回行显示如下:
return Record(content=None, row_entry=row_feed.entry[0],这意味着设计的函数不会返回内容?这没有太大的意义。我是不是用错了函数。我想要完成的是获得一行中单元格的值。我的电子表格( processedSheet引用的)有名为"votea“、"voteb”等的列标题。第一行是整数。那么,有什么想法吗?
发布于 2011-02-12 06:40:20
确保在电子表格中没有任何空行。API将在遇到第一个空行时停止读取数据,因此如果电子表格中的第一行为空,则不会得到任何结果。
https://stackoverflow.com/questions/4363062
复制相似问题