On 02/27/2014 01:04 PM, Barry Warsaw wrote:
> On Feb 26, 2014, at 09:21 PM, Mark Sapiro wrote:
> 
>> You have to put/or enable something in sitecustomize.py (On Ubuntu a symlink
>> to /etc/python2.7/sitecustomize.py) to get it to use the locale.
> 
> Have you changed your sitecustomize.py file?


Yes, I think so. I no longer remember exactly, but this is what I have now:

$ ll /usr/lib/python2.7/sitecustomize.py
lrwxrwxrwx 1 root root 31 Sep 19 07:47
/usr/lib/python2.7/sitecustomize.py -> /etc/python2.7/sitecustomize.py

$ cat /etc/python2.7/sitecustomize.py
# Set default encoding for locale (see site.py)
import sys
import locale
loc = locale.getdefaultlocale()
if loc[1]:
    sys.setdefaultencoding(loc[1])
# install the apport exception handler if available
try:
    import apport_python_hook
except ImportError:
    pass
else:
    apport_python_hook.install()

I think I added the first part based on stuff in the setencoding()
function in site.py


> You're right that sys.getdefaultencoding() gets initialized to 'ascii'
> everywhere for Python 2.7.  The default site.py doesn't change that (even on
> Ubuntu), and then it deletes sys.setdefaultencoding, so it's not possible to
> change that after initialization.


Right, so if you are going to setdefaultencoding(), you need to do it in
site.py or sitecustomize.py.

-- 
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan
_______________________________________________
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to