Thanks Alex, I think this is a rarely encountered bug in Mezzanine and coercing the description to unicode is probably fine as a fix because of the way Python is headed with strings: I did not have the problem when I imported into paulwhippconsulting.com which uses Python 3 rather than Python 2.
On 5 May 2014 01:12, Alex <[email protected]> wrote: > I'm experiencing the same issue with importing blog posts from Wordpress: > > File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line > 197, in string_literal > return db.string_literal(obj) > UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: > ordinal not in range(128) > > Using debugger I found that most obj'es get there as type 'str'. But once > obj comes as 'future.builtins.backports.newstr.newstr', stirng_literal() > crashes. > This happens for BlogPost.description auto-generated in > mezzanine/core/models.py line 165: > # Fall back to the title if description couldn't be determined. > if not description: > description = str(self) > > 'str' here is not a common python string but imported from future.builtins > as specified in mezzanine/core/models.py line 2. > > replacing it with > description = unicode(self) > fixed the issue for me. > > > On Wednesday, April 30, 2014 1:36:20 PM UTC+1, Kenneth Bolton wrote: >> >> Hi Paul, >> >> In my experience, the UnicodeDecodeError only happens if you have not set >> up your locale correctly. The highlighted section of the fabfile, here >> https://github.com/stephenmcd/mezzanine/blob/master/ >> mezzanine/project_template/fabfile.py#L346-L350, remedies this problem >> every time. >> >> hth, >> ken >> >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Mezzanine Users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/mezzanine-users/2-4lUfxEzZo/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
