List:General Discussion« Previous MessageNext Message »
From:Victor Subervi Date:October 4 2009 6:04pm
Subject:No tuples, but AttributeError about tuple!
View as plain text  
Hi;
I have the following python code:
      sql = 'insert into products values(%s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);', (id, name, title,
description, price, bedrooms, bathrooms, conditions, acreage, construction,
location, estate, address, furnished, pic1, pic2, pic3, pic4, pic5, pic6)
      cursor.execute(sql)

which, when printed to screen, gives the following:

insert into products values ('1', 'name1', 'title1', 'descr1', '1.1', '2',
'1', 'New', '1.5', 'new', 'princesse', 'princesse', '123 princesse', 'Not
furnished', '', '', '', '', '', '');

which I can enter into the database directly. However, when I try to do it
through the script, I get the following error:

AttributeError: 'tuple' object has no attribute 'encode'

Why is that? There are no tuples here!! Nothing but strings!!
TIA,
Victor

Thread
No tuples, but AttributeError about tuple!Victor Subervi4 Oct
  • Re: No tuples, but AttributeError about tuple!Michael Dykman5 Oct
Re: No tuples, but AttributeError about tuple!Victor Subervi5 Oct
Re: No tuples, but AttributeError about tuple!Victor Subervi6 Oct