From: Andy D. <an...@no...> - 2012-01-12 00:30:10
|
Hi, Guys I solved this : Cast your mind back - I was making a dialog.menu box, and inserting my choices using a database query, like this : > cursor.execute ("SELECT id, hostname FROM host WHERE user_id=%s", userid) > hostchoices = list(cursor.fetchall()) > while 1: > (code, tag) = d.menu( "Pick a host to manage?", > width=60, > choices=hostchoices ) 'id' in the database was actually an integer, and this integer type was being preserved into Python. dialog.menu requires that tags and items are strings, so I changed this code to literally force the type to string : def make_menuchoices(raw): choicelist = [] for row in raw: tag = str(row[0]) item = str(row[1]) tagitem = tag, item choicelist.append(tagitem) return choicelist [...] hostchoices = make_menuchoices(cursor.fetchall()) Now, pythondialog is working exactly as you (well, I...) would expect it to. It would have been more than nice for pythondialog to return some kind of type error, rather than crash with the error message as shown in the subject line. Andy |