TyeL89 0 Newbie Poster

I am creating a contact program with python and wxpython. While creating the browsing function for my program I ran into a problem. I've been searching for hours trying to find a way to fix it. Unfortunately I haven't had any luck on fixing the error/problem.

Here is the code that is giving me trouble/errors:

def BrowseDB(self):                                      
    connection = sqlite3.connect('*databasefile*.db')          
    cur = connection.cursor()                            

    rows = cur.execute("SELECT FirstName, LastName, Homephone, Cellphone, Email, BusinessName, Address, City, State, Zipcode FROM contacts")
    for row in rows:                                     
        print row                                        
        index = self.contactList.InsertStringItem(sys.maxint, str(row[0]))
        self.contactList.SetStringItem(index, 1, row[1]) 
        self.contactList.SetStringItem(index, 2, row[2]) 
        self.contactList.SetStringItem(index, 3, row[3]) 
        self.contactList.SetStringItem(index, 4, row[4]) 
        self.contactList.SetStringItem(index, 5, row[5]) 
        self.contactList.SetStringItem(index, 6, row[6]) 
        self.contactList.SetStringItem(index, 7, row[7]) 
        self.contactList.SetStringItem(index, 8, row[8]) 
        self.contactList.SetStringItem(index, 9, row[9])

Here is the error message:

File "C:/******/******/******/Development/Python/******/start.py", line 226, in OnBrowse self.BrowseDB()

File "C:/******/******/******/Development/Python/******/start.py", line 245, in BrowseDB index = self.contactList.InsertStringItem(sys.maxint, str(row[0]))

File "C:\Python27\lib\site-packages\wx-3.0-msw\wx_controls.py", line 4713, in InsertStringItem return controls.ListCtrl_InsertStringItem(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion "m_count == ListView_GetItemCount(GetHwnd())" failed at ....\src\msw\listctrl.cpp(1726) in wxListCtrl::InsertItem(): m_count should match ListView_GetItemCount

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.