Can't, because as a python warning, the "warnings" lib caches that message permanently, to support the typical case that the warnings filter is set to "once". If the message were unique for every value your app would slowly leak memory and also render the "once" filter non-functional.
If you want to know what the value is, raise the warning to an error, then use pdb.post_mortem() to debug the codepath that's delivering a non-unicode value. http://docs.python.org/2/library/warnings.html#the-warnings-filter Also in practice I frequently use a decoding wrapper to avoid the issue completely: http://docs.sqlalchemy.org/en/rel_0_8/core/types.html#coercing-encoded-strings-to-unicode On Jan 9, 2013, at 6:33 PM, Felix Schwarz wrote: > > sometimes I get unicode warnings from SQLAlchemy ("Unicode type received > non-unicode bind param value"). > > I find it very hard to fix these issues because I don't know where to look > (often it's not a string literal explicitely in the code but some external > library which returns a string instead of a unicode string). > > Could SQLAlchemy maybe add "repr(value)" to the unicode warning? The downside > would be that people who want to ignore these had to actually configure a > warning filter instead of just ignoring one line in the output. > > fs > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
