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 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.

Reply via email to