On Apr 5, 10:31 am, "erikcw" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to build a SQL string > > sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""", > (cid, ag, self.data[parent][child]['results']['test']) > > It raises this error: AttributeError: 'tuple' object has no attribute > 'encode' > > Some of the variables are unicode (test and ag) - is that what is > causing this error? What do I need to do to make it work? > > Thanks! > Erik
It sounds like you're not calling the "encode" method correctly. But it's hard to say when you didn't include that bit of code. You may need to check your database's docs to make sure it accepts unicode strings and if so, what types (utf-8, 16, 32). See this post for a similar problem: http://lists.modevia.com/archives/py-transports/2005-December/001719.html and this link details tuple usage: http://www.faqs.org/docs/diveintopython/odbchelper_tuple.html Mike -- http://mail.python.org/mailman/listinfo/python-list