Opened 9 years ago

Last modified 9 years ago

#23946 closed Bug

Runserver socket error in unicode fails to print error message — at Initial Version

Reported by: Andriy Sokolovskiy Owned by: Andriy Sokolovskiy
Component: Core (Management commands) Version: dev
Severity: Normal Keywords: unicode, runserver, management command
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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'))

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top