#23946: Runserver socket error in unicode fails to print error message
-------------------------------------+-------------------------------------
Reporter: coldmind | Owner: coldmind
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage:
Keywords: unicode, runserver, | Unreviewed
management command | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by coldmind):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> In `django.core.management.commands.runserver.Command#inner_run`, when
> catching socket error, can be a unicode problem.
> For example, after `error_text = str(e)` there can be an unicode text, so
> this line will raise `UnicodeDecodeError` and will not exit runserver
> command:
>
> {{{
>
> self.stderr.write("Error: %s" % error_text)
> }}}
>
>
> Simple solution:
>
>
> {{{
> self.stderr.write("Error: %s" % error_text.decode('utf-8'))
>
> }}}
New description:
In `django.core.management.commands.runserver.Command#inner_run`, when
catching socket error, can be a unicode problem.
For example, after `error_text = str(e)` there can be an unicode text, so
this line will raise `UnicodeDecodeError` and will not exit runserver
command:
{{{
self.stderr.write("Error: %s" % error_text)
}}}
Simple solution:
{{{
self.stderr.write("Error: %s" % error_text.decode('utf-8'))
}}}
Example of a problem: http://stackoverflow.com/questions/27248506
/starting-with-django-server/27251575
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23946#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.a669ba5fd4c122ad5514f6fdde96bb3d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.