id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 15778 Command createsuperuser fails under some system user names Hynek Cernoch Alex Gaynor "Commands 'createsuperuser' and 'syncdb' can not create a superuser account no way because of database error, if a system account username contains an 8-bit character. It fails when the name is automatically searched in the database, even if the user wants to write an ascii username manually. This is typical for usernames created by Microsoft Windows. {{{ File ""C:\Python26\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py"", line 72, in handle User.objects.get(username=default_username) ... File ""C:\Python26\lib\site-packages\django\db\backends\sqlite3\base.py"", line 234, in execute return Database.Cursor.execute(self, query, params) DatabaseError : You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. }}} Versions: Django 1.3, Python 2.6.4 windows, Sqlite3 3.5.9, dbapi 2.4.1 It is easier to fix it once then to circumvent it twice. The middle part of the patch: {{{ - default_username = getpass.getuser().replace(' ', '').lower() + default_username = str(getpass.getuser().decode('ascii', 'ignore')).replace(' ', '').lower() }}} " Bug closed contrib.auth 1.3 Normal fixed Accepted 1 0 1 0 0 0