Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'str' object has no attribute 'iteritems'

I'm trying to write a script that will write out to Google Docs Spreadsheet and when I run it I get the error in the title. More specifically:

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'

The piece of code that is causing this is:

entry = spr_client.InsertRow(data_str, spreadsheet_key, worksheet_id)
        if isinstance(entry, gdata.spreadsheet.SpreadsheetsList):
like image 865
user1813343 Avatar asked Nov 13 '22 18:11

user1813343


1 Answers

No, the line causing the error is row_data.iteritems() because row_data is a string and the method you're calling is not defined for the class 'str'.

like image 86
pascalhein Avatar answered Dec 16 '22 11:12

pascalhein