On Wed, Nov 09, 2011 at 03:38:23PM +0000, Tom Evans wrote:
> On Wed, Nov 9, 2011 at 3:24 PM, Niels <[email protected]> wrote:
> > Is this a known bug?
> >
> > csh .. > python manage.py syncdb
> >
> > Creating tables ...
> > Creating table auth_permission
> >    default_username = get_system_username()
> >  File 
> > "/usr/local/www/site-python/lib/django-trunk/django/contrib/auth/management/__init__.py",
> >  line 85, in get_system_username
> >    return getpass.getuser().decode(locale.getdefaultlocale()[1])
> > TypeError: decode() argument 1 must be string, not None
> >
> > This is just from a normal useracccount logged in through ssh:
> >
> > csh .. > uname -or
> > FreeBSD 9.0-RC2
> > csh .. > svn info /usr/local/www/site-python/lib/django-trunk/django
> > Revision: 17077
> >
> > csh .. > _
> 
> What locale are you in (output of locale(1) would be handy)? You
> should be able to reproduce this without django, django just makes
> assumptions that you have a sane locale set:
> 
> Python 2.7.1 (r271:86832, Dec 13 2010, 15:52:15)
> [GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import locale
> >>> locale.getdefaultlocale()
> ('en_GB', 'UTF-8')
> 
> You will probably get ('something', None) returned from yours?

Worse:
>>> locale.getdefaultlocale()
(None, None)

Still i'd say this should be handled better than bailing out with an error.
Something like .. .decode(locale.getdefaultlocale()[1] or 'ascii', 'ignore')

> 
> Cheers
> 
> Tom

Thanks.

Niels.

--

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to