On 26/08/16 02:34, Jim Byrnes wrote: > Exception in Tkinter callback > Traceback (most recent call last): ... > File "tk_pwds.py", line 56, in fill_accounts_lb > cur.execute('''SELECT Account FROM pwds WHERE Category=? ORDER BY > Account COLLATE NOCASE''', category) > sqlite3.ProgrammingError: Incorrect number of bindings supplied. The > current statement uses 1, and there are 8 supplied. > > I cut the working statement from pythoncard and pasted it into tkinter > and am curious why it works in the pythoncard version and not the > tkinter version.
Peter has given the solution, but just to be clear this has nothing whatsoever to do with Tkinter v Pythoncard it is entirely a Sqlite issue. (As is evidenced in the error message.) Did you use an older version of Sqlite when you wrote the Pythoncard code perhaps? You probably also used an older version of Python? The real mystery is how it worked in the Pythoncard version, unless, as Peter suggests, you just got lucky and always passed a single valued item? Finally, the string formatting solution is never a good idea for database queries since it is (a) open to injection attack and (b) liable to generate an incorrect SQL query which is hard to debug. (ie the query gets executed but returns different data to what you expected/wanted) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor