私はGoogle Docs Spreadsheetに書き込むスクリプトを書こうとしています。実行するとタイトルにエラーが発生します。具体的には:AttributeError: 'str'オブジェクトに 'iteritems'という属性がありません
File "/home/pi/Desktop/templog.py", line 44, in <module>
s.run()
File "/usr/lib/python2.7/sched.py", line 117, in run
action(*argument)
File "/home/pi/Desktop/templog.py", line 35, in do_something
entry = spr_client.InsertRow(data_str, spreadsheet_key, worksheet_id)
File "/usr/local/lib/python2.7/dist-packages/gdata/spreadsheet/service.py", line 330, in InsertRow
for k, v in row_data.iteritems():
AttributeError: 'str' object has no attribute 'iteritems'
これを引き起こしているコードの一部は次のとおりです。
entry = spr_client.InsertRow(data_str, spreadsheet_key, worksheet_id)
if isinstance(entry, gdata.spreadsheet.SpreadsheetsList):
私は、 'InsertRow'は最初のパラメータが文字列ではなくカラム名に値をマップする辞書であると考えていると思います。 – eldarerathis
あなたは正しいと思います - 返事をありがとう。 – user1813343