On Tue, Apr 22, 2014 at 3:17 PM, Skyler Dawson <foxwoods...@gmail.com>wrote:

> And the error has been found. I had at one point changed my settings to
> figure out paths using unipath:
> PROJECT_ROOT = Path(__file__).ancestor(2)
> MEDIA_ROOT = PROJECT_ROOT.child("media")
>
> So in the template tag it was joining a unipath path object to unicode
> strings, and the path objects decide whether or not to use unicode or str
> in python 2 based on os.path.supports_unicode_filenames, which is False on
> posix systems (minus darwin). So MEDIA_ROOT was a str that was trying to be
> joined with unicode, and as the first element in the sequence errors
> occurred. I've since moved the path object to another variable and now
> properly wrap all the settings vars that use it with unicode().
>
> Sorry for the noise, and if someone else setup like I did, hopefully this
> helps them out.
>
>
No sweat - thanks for posting the outcome.


>
>
> On Monday, 21 April 2014 21:14:16 UTC-4, Skyler Dawson wrote:
>>
>> Hi all,
>>
>> Probably a configuration issue on my part, but I'm getting to my wits
>> end. Site crashes in the thumbnail template tag on any gallery related
>> portion:
>> UnicodeEncodeError at /
>>
>> 'ascii' codec can't encode character u'\u0301' in position 83: ordinal not 
>> in range(128)
>>
>>
>>
>>    - /home/foxwoods/.virtualenvs/skylerdawson.com/local/lib/
>>    
>> python2.7/site-packages/mezzanine/core/templatetags/mezzanine_tags.py<http://skylerdawson.com/local/lib/python2.7/site-packages/mezzanine/core/templatetags/mezzanine_tags.py>in
>>    thumbnail
>>    1.
>>
>>                                    settings.THUMBNAILS_DIR_NAME, image_name)
>>
>>       ...
>>     ▼ Local vars <http://localhost:8000/#>
>>      Variable Value   thumb_name
>>
>>    u'A\u0301vila, Spain_2-90x90.jpg'
>>
>>     ImageFile
>>
>>    <module 'PIL.ImageFile' from 
>> '/home/foxwoods/.virtualenvs/skylerdawson.com/local/lib/python2.7/site-packages/PIL/ImageFile.pyc'>
>>
>>      image_prefix
>>
>>    u'A\u0301vila, Spain_2'
>>
>>     padding_color
>>
>>    u'#fff'
>>
>>     image_dir
>>
>>    u'uploads/gallery'
>>
>>     Image
>>
>>    <module 'PIL.Image' from 
>> '/home/foxwoods/.virtualenvs/skylerdawson.com/local/lib/python2.7/site-packages/PIL/Image.pyc'>
>>
>>      filetype
>>
>>    u'JPEG'
>>
>>     image_name
>>
>>    u'A\u0301vila, Spain_2.jpg'
>>
>>     height
>>
>>    90
>>
>>     padding
>>
>>    False
>>
>>     width
>>
>>    90
>>
>>     image_url
>>
>>    'uploads/gallery/A\u0301vila, Spain_2.jpg'
>>
>>     ImageOps
>>
>>    <module 'PIL.ImageOps' from 
>> '/home/foxwoods/.virtualenvs/skylerdawson.com/local/lib/python2.7/site-packages/PIL/ImageOps.pyc'>
>>
>>      quality
>>
>>    95
>>
>>     top
>>
>>    0.5
>>
>>     image_ext
>>
>>    u'.jpg'
>>
>>     left
>>
>>    0.5
>>
>>      - /home/foxwoods/.virtualenvs/skylerdawson.com/lib/python2.7/
>>    posixpath.py in join
>>    1.
>>
>>                   path += '/' + b
>>
>>       ...
>>     ▶ Local vars <http://localhost:8000/#>
>>    - /home/foxwoods/.virtualenvs/skylerdawson.com/local/lib/
>>    
>> python2.7/site-packages/unipath/abstractpath.py<http://skylerdawson.com/local/lib/python2.7/site-packages/unipath/abstractpath.py>in
>>    __add__
>>    1.
>>
>>               return self.__class__(resultStr)
>>
>>       ...
>>     ▶ Local vars <http://localhost:8000/#>
>>    - /home/foxwoods/.virtualenvs/skylerdawson.com/local/lib/
>>    
>> python2.7/site-packages/unipath/abstractpath.py<http://skylerdawson.com/local/lib/python2.7/site-packages/unipath/abstractpath.py>in
>>    __new__
>>    1.
>>
>>               return _base.__new__(class_, newpath)
>>
>>       ...
>>     ▶ Local vars <http://localhost:8000/#>
>>
>>
>> Unicode error hint
>>
>> The string that could not be encoded/decoded was: *ils/Ávila,*
>>
>> On my root page I'm displaying the last 9 gallery images, which currently
>> has the default image data provided as a fixture when creating my sample
>> mezzanine db.
>>  So I've read that this could be an issue when I created the database
>> apparently, but my locale seems to be setup properly, and I've tried
>> recreating the DB specifically setting the character encoding as UTF8
>> (postgresql). Using SHOW ALL; on my database shows all the locales set to
>> en_CA.UTF-8. And the output of locale:
>> foxwoods@FoxwoodsWebDev ~ $ locale
>> LANG=en_CA.UTF-8
>> LANGUAGE=en_CA.UTF-8
>> LC_CTYPE="en_CA.UTF-8"
>> LC_NUMERIC="en_CA.UTF-8"
>> LC_TIME="en_CA.UTF-8"
>> LC_COLLATE="en_CA.UTF-8"
>> LC_MONETARY="en_CA.UTF-8"
>> LC_MESSAGES="en_CA.UTF-8"
>> LC_PAPER="en_CA.UTF-8"
>> LC_NAME="en_CA.UTF-8"
>> LC_ADDRESS="en_CA.UTF-8"
>> LC_TELEPHONE="en_CA.UTF-8"
>> LC_MEASUREMENT="en_CA.UTF-8"
>> LC_IDENTIFICATION="en_CA.UTF-8"
>> LC_ALL=en_CA.UTF-8
>>
>> So I'm not sure if this is an error in the template tag code or in my
>> db/environment setup.
>>
>>  --
> 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 mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stephen McDonald
http://jupo.org

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to