[web2py] Re: HELP - type 'exceptions.TypeError'('Set' object is not iterable)

2012-10-16 Thread Niphlod
did you try printing query3 before starting the for loop ?

On Tuesday, October 16, 2012 10:51:28 PM UTC+2, Simon Carr wrote:

 HI All,

 I am up against the wall as far as time is concerned, I have promised I 
 will get the images for his updated products on his site by end of play 
 today and this is the first time I have used web2py to automate most of the 
 process.

 I am getting this error
 type 'exceptions.TypeError'('Set' object is not iterable)

 Here is the offending piece of code. 

 query3 = cmdb(cmdb.executesql(select image.id_product, image.id_image, 
 product.reference from image join product on product.id_product = 
 image.id_product))
 for row in query3:
 image_list_file.write(row.id_product + , + row.id_image + , +row
 .reference + \n)

 and here is the full Traceback

 TRACEBACK

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.

 Traceback (most recent call last):
   File /home/simon/web2py/gluon/restricted.py, line 205, in restricted
 exec ccode in environment
   File /home/simon/web2py/applications/update_vitaldb/controllers/vital.py 
 http://localhost:8000/admin/default/edit/update_vitaldb/controllers/vital.py,
  line 133, in module
   File /home/simon/web2py/gluon/globals.py, line 173, in lambda
 self._caller = lambda f: f()
   File /home/simon/web2py/applications/update_vitaldb/controllers/vital.py 
 http://localhost:8000/admin/default/edit/update_vitaldb/controllers/vital.py,
  line 130, in image_database_prep
 for row in query3:
 TypeError: 'Set' object is not iterable



 Any help would be much appreciated.

 Thanks
 Simon







-- 





[web2py] Re: HELP - type 'exceptions.TypeError'('Set' object is not iterable)

2012-10-16 Thread Niphlod
whoops, gotcha.
syntax for executesql is rows = db.executesql(), not rows = 
db(db.executesql()) :-P

now, go back hitting the wall :P

-- 





[web2py] Re: HELP - type 'exceptions.TypeError'('Set' object is not iterable)

2012-10-16 Thread Simon Carr
Many Many Thanks,

I owe you a beer.

Simon

On Tuesday, 16 October 2012 22:09:46 UTC+1, Niphlod wrote:

 whoops, gotcha.
 syntax for executesql is rows = db.executesql(), not rows = 
 db(db.executesql()) :-P

 now, go back hitting the wall :P


--