[Django] #28487: Django1.11.4 Cannot run `manage.py runserver` on Windows (UnicodeDecodeError:)

26 views
Skip to first unread message

Django

unread,
Aug 10, 2017, 10:40:55 PM8/10/17
to django-...@googlegroups.com
#28487: Django1.11.4 Cannot run `manage.py runserver` on Windows
(UnicodeDecodeError:)
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: nobody
Type: Bug | Status: new
Component: Core | Version: 1.11
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
My env is windows 7 x64 Python 2.7, after upgrade to 1.11.4 , i can't run
manager.py runserver
In 1.11.3 is ok,anything with "Fixed crash in runserver’s autoreload with
Python 2 on Windows with non-str environment variables (#28174)."
============================================================

{{{
(users) D:\django_test\dddd>pip install --upgrade django
Collecting django
Using cached Django-1.11.4-py2.py3-none-any.whl
Requirement already up-to-date: pytz in d:\env_python\users\lib\site-
packages (from django)
Installing collected packages: django
Found existing installation: Django 1.11.3
Uninstalling Django-1.11.3:
Successfully uninstalled Django-1.11.3
Successfully installed django-1.11.4

(users) D:\django_test\dddd>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "D:\env_python\users\lib\site-
packages\django\core\management\__init__.py", line 363, in
execute_from_command_line
utility.execute()
File "D:\env_python\users\lib\site-
packages\django\core\management\__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\env_python\users\lib\site-
packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\env_python\users\lib\site-
packages\django\core\management\commands\runserver.py", line 62, in
execute
super(Command, self).execute(*args, **options)
File "D:\env_python\users\lib\site-
packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "D:\env_python\users\lib\site-
packages\django\core\management\commands\runserver.py", line 101, in
handle
self.run(**options)
File "D:\env_python\users\lib\site-
packages\django\core\management\commands\runserver.py", line 110, in run
autoreload.main(self.inner_run, None, options)
File "D:\env_python\users\lib\site-packages\django\utils\autoreload.py",
line 341, in main
reloader(wrapped_main_func, args, kwargs)
File "D:\env_python\users\lib\site-packages\django\utils\autoreload.py",
line 312, in python_reloader
exit_code = restart_with_reloader()
File "D:\env_python\users\lib\site-packages\django\utils\autoreload.py",
line 294, in restart_with_reloader
str_value = force_bytes(new_environ[key], encoding=encoding)
File "D:\env_python\users\lib\site-packages\django\utils\encoding.py",
line 124, in force_bytes
return s.decode('utf-8', errors).encode(encoding, errors)
File "D:\env_python\users\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb8 in position 202:
invalid start byte
}}}

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

Django

unread,
Aug 11, 2017, 8:13:03 AM8/11/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4

-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* cc: Mark Rogaski (added)


Comment:

What's the key/value of the environment variable that's causing the crash?

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

Django

unread,
Aug 12, 2017, 2:28:00 AM8/12/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by newerBkl):

Replying to [comment:1 Tim Graham]:


> What's the key/value of the environment variable that's causing the
crash?

I have no idea, it's just a new project without my own code and the
traceback doesn't give me any ideas about the cause.

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

Django

unread,
Aug 12, 2017, 8:46:49 AM8/12/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

You can add `print(key, new_environ[key])` before the line with
`force_bytes(new_environ[key], encoding=encoding)` to see the problematic
value.

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

Django

unread,
Aug 12, 2017, 11:10:26 PM8/12/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by newerBkl):

Replying to [comment:3 Tim Graham]:


> You can add `print(key, new_environ[key])` before the line with
`force_bytes(new_environ[key], encoding=encoding)` to see the problematic
value.

**Thanks , here is the output**

{{{
('TMP', 'C:\\Users\\100000\\AppData\\Local\\Temp')
('PSMODULEPATH',
'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\')
('PROCESSOR_LEVEL', '6')
('_OLD_VIRTUAL_PATH', 'C:\\Program Files (x86)\\Common
Files\\NetSarang;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows
;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program
Files (x86)\\\xb8\xbb\xbb\xf9\xd0\xfd\xb7\xe7\xbf\xc
6\xbc\xbc\\appSys01;C:\\Program Files
(x86)\\\xb8\xbb\xbb\xf9\xd0\xfd\xb7\xe7\xbf\xc6\xbc\xbc\\appSys02;C:\\Program
Files (x86)\\\xb8\xbb\xbb\
xf9\xd0\xfd\xb7\xe7\xbf\xc6\xbc\xbc\\appSys01;C:\\Program Files
(x86)\\\xb8\xbb\xbb\xf9\xd0\xfd\xb7\xe7\xbf\xc6\xbc\xbc\\appSys02;C:\\Program
Files
(x86)\\\xb8\xbb\xbb\xf9\xd0\xfd\xb7\xe7\xbf\xc6\xbc\xbc\\appSys03;C:\\Program
Files\\TortoiseSVN\\bin;;C:\\Program Files\\Microsoft VS C
ode\\bin')


Traceback (most recent call last):
}}}

**
there was a path with Chinese in my system_path.After removing ,it works
well**

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

Django

unread,
Aug 20, 2017, 5:39:50 AM8/20/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacek Kałucki):

* Attachment "encoding.diff" added.

Django

unread,
Aug 22, 2017, 5:00:18 PM8/22/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: Mark
| Rogaski
Type: Bug | Status: assigned

Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mark Rogaski):

* owner: nobody => Mark Rogaski
* status: new => assigned


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

Django

unread,
Aug 22, 2017, 5:00:58 PM8/22/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: Mark
| Rogaski
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


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

Django

unread,
Aug 26, 2017, 10:41:51 AM8/26/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: Mark
| Rogaski
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8969 PR]

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

Django

unread,
Aug 29, 2017, 3:04:33 PM8/29/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: Mark
| Rogaski
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

[https://github.com/django/django/pull/8985 New PR] that only touches the
autoreloader instead of changing `force_bytes()`.

--
Ticket URL: <https://code.djangoproject.com/ticket/28487#comment:8>

Django

unread,
Aug 30, 2017, 2:36:19 PM8/30/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: Mark
| Rogaski
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28487#comment:9>

Django

unread,
Aug 31, 2017, 8:00:50 AM8/31/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: Mark
| Rogaski
Type: Bug | Status: closed

Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"80a0016c49331bf0a14ef76e714acbff6c6640bd" 80a0016]:
{{{
#!CommitTicketReference repository=""
revision="80a0016c49331bf0a14ef76e714acbff6c6640bd"
[1.11.x] Fixed #28487 -- Fixed runserver crash with non-Unicode system
encodings on Python 2 + Windows.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28487#comment:10>

Django

unread,
Aug 31, 2017, 8:02:25 AM8/31/17
to django-...@googlegroups.com
#28487: runserver crashes with UncodeDecodeError as of Django 1.11.4
-------------------------------------+-------------------------------------
Reporter: newerBkl | Owner: Mark
| Rogaski
Type: Bug | Status: closed
Component: Core (Management | Version: 1.11
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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

In [changeset:"11cd46930e893a9cb28f7e05c7e221ed5d40f8e0" 11cd4693]:
{{{
#!CommitTicketReference repository=""
revision="11cd46930e893a9cb28f7e05c7e221ed5d40f8e0"
Refs #28487 -- Forwardported 1.11.5 release note.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28487#comment:11>

Reply all
Reply to author
Forward
0 new messages