Re: problem with appending to a list, possibly mysqldb related
- From: John Purser <jmpurser@xxxxxxxxx>
- Date: Thu, 31 Aug 2006 11:30:19 -0700
On Thu, 31 Aug 2006 18:11:15 GMT
John Salerno <johnjsal@xxxxxxxxxxxxxxx> wrote:
Here's the code:
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY)
panel = wx.Panel(self)
dbconn = self.connect_db()
dbconn.execute("select namefirst, namelast from master")
bb_players = []
for x in dbconn.fetchall():
bb_players.append(' '.join(x))
cb = PromptingComboBox(panel, 'Choose A Player',
choices=bb_players, style=wx.CB_SORT)
def connect_db(self):
connection = MySQLdb.connect('localhost', 'john', '*******',
'bbdatabank')
return connection.cursor()
The error seems to be in the for loop. I get this:
Traceback (most recent call last):
File "C:\Python24\myscripts\bbdata_access\bbdata.py", line 71, in
-toplevel-
app = MyApp(False)
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py",
line 7700, in __init__
self._BootstrapApp()
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py",
line 7352, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "C:\Python24\myscripts\bbdata_access\bbdata.py", line 64, in
OnInit frame = MyFrame()
File "C:\Python24\myscripts\bbdata_access\bbdata.py", line 15, in
__init__
name = ' '.join(x)
TypeError: sequence item 0: expected string, NoneType found
>>>
John,
I'd say you had a record with a null value for the namefirst field.
The join method don't like that.
John Purser
--
You are destined to become the commandant of the fighting men of the
department of transportation.
.
- Follow-Ups:
- Re: problem with appending to a list, possibly mysqldb related
- From: John Salerno
- Re: problem with appending to a list, possibly mysqldb related
- References:
- problem with appending to a list, possibly mysqldb related
- From: John Salerno
- problem with appending to a list, possibly mysqldb related
- Prev by Date: Re: csv module strangeness.
- Next by Date: Re: problem with appending to a list, possibly mysqldb related
- Previous by thread: problem with appending to a list, possibly mysqldb related
- Next by thread: Re: problem with appending to a list, possibly mysqldb related
- Index(es):