[Django] #22882: UnicodeDecodeError in command flush

13 views
Skip to first unread message

Django

unread,
Jun 22, 2014, 8:59:18 PM6/22/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------+--------------------
Reporter: djbaldey | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords: flush
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I use PostgreSQL in my projects. OS: GNU/Debian 7/8 on production, and
Linux Mint 17 on development.
DBMS returns messages as Russian text.

{{{
djbaldey@p633m project $ ../manage.py flush
You have requested a flush of the database.
This will IRREVERSIBLY DESTROY all data currently in the u'plx_dev'
database,
and return each table to the state it was in after syncdb.
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "../manage.py", line 60, in <module>
execute_from_command_line(sys.argv)
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/__init__.py", line 399, in
execute_from_command_line
utility.execute()
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/commands/flush.py", line 77, in
handle_noargs
"The full error: %s") % (connection.settings_dict['NAME'], e)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0:
ordinal not in range(128)

}}}

Patch in django/core/management/commands/flush.py:

{{{
from django.utils.encoding import smart_text
...

"The full error: %s") % (connection.settings_dict['NAME'], smart_text(e))
...
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22882>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 23, 2014, 3:17:39 AM6/23/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------+------------------------------------

Reporter: djbaldey | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: flush | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

#20572 is related.

--
Ticket URL: <https://code.djangoproject.com/ticket/22882#comment:1>

Django

unread,
Jul 31, 2014, 10:56:28 PM7/31/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------+------------------------------------

Reporter: djbaldey | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: flush | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by djbaldey):

UPD: in command dumpdata
{{{
djbaldey@p633m project $ ../manage.py dumpdata users
[Traceback (most recent call last):


File "../manage.py", line 60, in <module>
execute_from_command_line(sys.argv)
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/__init__.py", line 399, in
execute_from_command_line
utility.execute()
File "/home/djbaldey/env-django1.6/lib/python2.7/site-
packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/djbaldey/env-django1.6/lib/python2.7/site-

packages/django/core/management/base.py", line 249, in run_from_argv
stderr.write('%s: %s' % (e.__class__.__name__, force_str(e)))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 30:
ordinal not in range(128)
}}}

Patch in django/core/management/commands/base.py:
{{{
from django.utils.encoding import force_str, smart_text
...

stderr.write('%s: %s' % (e.__class__.__name__, smart_text(e)))
...
}}}

After:

{{{
djbaldey@p633m project $ ../manage.py dumpdata users
CommandError: Unable to serialize database: ОШИБКА: отношение
"users_permission" не существует
LINE 1: ...."built_type", "users_permission"."codename" FROM "users_per...
^
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22882#comment:2>

Django

unread,
Aug 31, 2014, 3:40:01 PM8/31/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------------+-------------------------------------

Reporter: djbaldey | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: flush | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* component: Uncategorized => Core (Management commands)


--
Ticket URL: <https://code.djangoproject.com/ticket/22882#comment:3>

Django

unread,
Sep 5, 2014, 6:42:02 PM9/5/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------------+-------------------------------------
Reporter: djbaldey | Owner: fcurella
Type: Bug | Status: assigned

Component: Core (Management | Version: 1.6
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: flush | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by fcurella):

* owner: nobody => fcurella
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/22882#comment:4>

Django

unread,
Sep 5, 2014, 6:47:47 PM9/5/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------------+-------------------------------------
Reporter: djbaldey | Owner: fcurella
Type: Bug | Status: assigned
Component: Core (Management | Version: master

commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: flush | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0

Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by fcurella):

* has_patch: 0 => 1
* version: 1.6 => master
* needs_tests: 0 => 1


Comment:

I've taken the liberty to create a PR implementing the fixes mentioned in
the description

https://github.com/django/django/pull/3172

--
Ticket URL: <https://code.djangoproject.com/ticket/22882#comment:5>

Django

unread,
Sep 6, 2014, 10:08:42 AM9/6/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------------+-------------------------------------
Reporter: djbaldey | Owner: fcurella
Type: Bug | Status: closed

Component: Core (Management | Version: master
commands) | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: flush | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"0e4d79c4f0591da3d2b0cf030cb8a79abe482345"]:
{{{
#!CommitTicketReference repository=""
revision="0e4d79c4f0591da3d2b0cf030cb8a79abe482345"
Fixed #22882 -- Fixed a UnicodeDecodeError in flush.

Thanks djbaldey for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22882#comment:6>

Django

unread,
Sep 6, 2014, 10:09:48 AM9/6/14
to django-...@googlegroups.com
#22882: UnicodeDecodeError in command flush
-------------------------------------+-------------------------------------
Reporter: djbaldey | Owner: fcurella
Type: Bug | Status: closed
Component: Core (Management | Version: master
commands) | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: flush | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"a932c596fc5bfcfcb358981540917c8d6f9dc575"]:
{{{
#!CommitTicketReference repository=""
revision="a932c596fc5bfcfcb358981540917c8d6f9dc575"
[1.7.x] Fixed #22882 -- Fixed a UnicodeDecodeError in flush.

Thanks djbaldey for the report.

Backport of 0e4d79c4f0 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22882#comment:7>

Reply all
Reply to author
Forward
0 new messages