Weird bug with an integer

David Anderson zerty.david at gmail.com
Thu May 8 21:47:59 EDT 2008


Ps:
When I go to shell and type:rowN = int(0)

rows = [["1223", "11/23/08", "Purchase", "To be shipped", "Gallery Name",
"Art Title[22 of 300]", "$10,000"],#1st row
                ["1223", "11/23/08", "Purchase", "To be shipped", "Gallery
Name", "Art Title[22 of 300]", "$10,000"],#2nd row
                ["1223", "11/23/08", "Purchase", "To be shipped", "Gallery
Name", "Art Title[22 of 300]", "$10,000"],#etc, obviouslly these info will
be fetched from the db
                ["1223", "11/23/08", "Purchase", "To be shipped", "Gallery
Name", "Art Title[22 of 300]", "$10,000"]
                ]
for row in rows:

    colN = int(0)
    for col in row:
        print str(colN) + "," + str(rowN) + " - " + col


It works and print everything correctly Oo
On Thu, May 8, 2008 at 10:44 PM, David Anderson <zerty.david at gmail.com>
wrote:

> Look this slice of code:
>
> rowN = int(0)
>         for row in rows:
>             success = self.resultGrid.AppendRows();
>             colN = int(0)
>             for col in row:
>                 self.resultGrid.SetReadOnly(self.resultGrid.GetNumberRows()
> - 1,colN,isReadOnly = True)
>                 print rowN
>                 self.resultGrid.SetCellValue(int(rowN),int(colN),col)
>
> I am getting this output:
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> (1,)
> Traceback (most recent call last):
>      in populateGrid
>     self.resultGrid.SetCellValue(int(rowN),int(colN),col)
> TypeError: int() argument must be a string or a number, not 'tuple'
>
>
> Why is this happening?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080508/45b7763c/attachment-0001.html>


More information about the Python-list mailing list