OK as I said earlier, I'm not able to reproduce this.    So I'd need that 
reproduction case in order to do anything.   To be honest it sounds more like a 
psycopg2 bug, since psycopg2 does the decoding in most cases nowadays and even 
works with Python 3, so for it to be raising an exception with the "bytes" type 
for the message is certainly a bug.   But would need to see a real world 
example to get a feel for it.


On Dec 20, 2012, at 7:03 AM, Sylvain Prat wrote:

> Sorry to ressurrect this thread but the problem is still there. Since 
> SQLAlchemy knows the encoding used to communicate with the database, it can 
> properly decode the error strings returned by the database to unicode. So, I 
> think it should be SQLAlchemy's responsibility to convert the error strings 
> to unicode, not the user's responsibility. Could we open a bug for that in 
> the tracker?
> 
> Sylvain
> 
> 
> Le vendredi 7 mars 2008 02:39:56 UTC+1, jean-philippe dutreve a écrit :
> On 7 mar, 02:29, Michael Bayer <mike...@zzzcomputing.com> wrote: 
> 
> > logging module itself throws UnicodeDecodeError ? 
> yes, in logging.format: ... = "%s" % msg 
> with msg the exception message encoded in utf8 and the default 
> encoding is ascii. 
> 
> > are you sending exception messages using logging.debug() or similar ? 
> exactly: log.error("... : %s", e.message) 
> 
> my impression 
> > is that you'd want to decode those manually doing something like 
> > string.decode('utf-8'). 
> yes, it works fine, but it's pain to do this in each try/except. 
> Another solution is setting utf8 as the default encoding in 
> sitecustomize.py. 
> It's better centralized, but has sitepackage effect. 
> 
> But a better way IMHO is that the DB driver or SA returns unicode 
> exception message. 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sqlalchemy/-/OOEvbKoo63cJ.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to