Can anyone tell me why I get the following error? I am creating a new object, and then trying to access that object via a newly queried second object. And getting a list index out of range error. If I simply iterate through the new list (without referring to the item by index) then it will appear in the list. If I run a different script with the same code querying the table I can access it okay.
 
 
from SQLObject import *
 

class Person(SQLObject):
    _connection = MySQLConnection(host='localhost', db='jcpos',
                           user='test', passwd='')
    first_name = StringCol(length=100,default="")
    middle_initial = StringCol(length=1, default="")
    last_name = StringCol(length=100, default="")
 

newperson = Person.new(first_name="Mike")
newid = newperson.id
 
listofpersons = Person.select()
print listofpersons[newid].first_name
 
Traceback (most recent call last):
  File "D:\dev\pythontest\sqlerror.py", line 18, in ?
    print listofpersons[newid].first_name
  File "C:\Python23\Lib\site-packages\SQLObject\SQLObject.py", line 1056, in __g
etitem__
    return list(self.clone(start=value, stop=value+1))[0]
IndexError: list index out of range