Re: Incompatible Data Type?
Adrian Klaver <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
On Tuesday 26 December 2006 5:44 pm, Rich Shepard wrote: > On Tue, 26 Dec 2006, Adrian Klaver wrote: > > My guess is you are not picking up the correct variable. > > Adrian, > > I've looked closely at that today, and I don't think that's it. But, > based on your comments, I replaced the 'self.va' with the number > 0.18000000. The records are then added to the database. > > Now, immediately before the SQL statement (I've gone back to the > full-blown one, not the truncated testing version), I have the statement, > 'print self.va.' > > Run 1: I did not change the widget from the default of 0.20, and the > above print statement showed the value in unicode; that is, > > u0.20000000 > > Run 2: I changed the value in the widget using the bound method > > def OnAlphaCut(self, event): > self.va = self.valphaVal.GetValue() > print "In OnAlphaCut: ", self.va, '\n' > > and that print statement produced: > > In OnAlphaCut: 0.19000000 > > In OnAlphaCut: 0.18000000 > > In OnAlphaCut: 0.17000000 For my own information. Why are there three values returned? > > so self.va is being changed in the widget. The pre-SQL print statement > now prints > > 0.17000000 > > without the prepended 'u'. The print statement cleans up the unicode notation. > > This is the same testing I did earlier today to ensure that it was the > proper variable that was to be used in the insert statement. But, as soon > as I revert to the 'self.va' the error reappears. Quite frustrating. Every > other variable is correctly assigned (they're all text or integers, 'va' is > the only real in the table), so I've no idea what else might be causing > that problem. I suspect it's somehow related to the data type, but I've no > idea how. > > Thanks, > > Rich Try casting the self.va to float i.e float(self.va). Your next message arrived while I was writing this one. The same answer applies. -- Adrian Klaver [email protected]