开发者

App Engine getRecord not returning content

开发者 https://www.devze.com 2023-01-29 13:32 出处:网络
In Google App Engine, I am trying to get a specific record and the content associated with it.I use the following (relevant) code (all necessary GData is imported and the client is authenticated):

In Google App Engine, I am trying to get a specific record and the content associated with it. I use the following (relevant) code (all necessary GData is imported and the client is authenticated):

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="0AqKqcvXa开发者_开发知识库m_kcdFlfckZfVzRiaVpRelp2T1FsVl9rRHc")
processedSheet = ss[0].GetTables(worksheet_id=1)

targetTotals = processedSheet[0].GetRecord(row_number=1)
total1 = targetTotals.content["votea"]

The problem is in the last line. It throws this error:

AttributeError: 'NoneType' object has no attribute 'content'

I looked in the source code for the GData spreadsheets text_db module and the return line says this:

return Record(content=None, row_entry=row_feed.entry[0],

Meaning that the function by design doesn't return the content? That doesn't make too much sense. Am I using the wrong function. What I'm trying to accomplish is to get the value of the cells in a row. My spreadsheet (that processedSheet is referring to) has column headers called "votea", "voteb", etc. The first row is integers. So, any ideas?


make sure you don't have any empty rows in spreadsheet. API will stop reading data when it encounters first empty line, so if your first row in spreadsheet is empty, you wont get any results.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号