#30184: Django 2.2b1 throws error on Windows in default code page
-------------------------------+--------------------------------------
     Reporter:  Dan Davis      |                    Owner:  Dan Davis
         Type:  Uncategorized  |                   Status:  assigned
    Component:  Core (Other)   |                  Version:  2.2
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  1              |                    UI/UX:  0
-------------------------------+--------------------------------------
Description changed by Dan Davis:

Old description:

> By default, Windows terminals start with code page 437, which is roughly
> equivalent to ASCII.   While working on #30178, I discovered that this
> causes the following traceback:
>
> ```
> (mplusmon) λ manage.py runserver
> Watchman unavailable: pywatchman not installed.
> Watching for file changes with StatReloader
> Exception in thread Thread-1:
> Traceback (most recent call last):
>   File "c:\tools\python\3.5\Lib\threading.py", line 914, in
> _bootstrap_inner
>     self.run()
>   File "c:\tools\python\3.5\Lib\threading.py", line 862, in run
>     self._target(*self._args, **self._kwargs)
>   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\site-
> packages\django\utils\autoreload.py", line 54, in wrapper
>     fn(*args, **kwargs)
>   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\site-
> packages\django\core\management\commands\runserver.py", line 116, in
> inner_run
>     self.stdout.write("Performing system checks\u2026\n\n")
>   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\site-
> packages\django\core\management\base.py", line 145, in write
>     self._out.write(style_func(msg))
>   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\encodings\cp437.py",
> line 19, in encode
>     return codecs.charmap_encode(input,self.errors,encoding_map)[0]
> UnicodeEncodeError: 'charmap' codec can't encode character '\u2026' in
> position 24: character maps to <undefined>
> ```
>
> The problem can be resolved by changing the code page to UTF-8, as
> follows:
>
> ```
> chcp 65001
> ```
>
> This appears to be a new issue relative to Django 2.1.7, because the
> problem did not occur there.    I'll track down wherever someone entered
> the horizontal elipsis character rather than "..." into the code, because
> this ought to be easy enough to fix.

New description:

 By default, Windows terminals start with code page 437, which is roughly
 equivalent to ASCII.   While working on #30178, I discovered that this
 causes the following traceback:

 {{{
 (mplusmon) λ manage.py runserver
 Watchman unavailable: pywatchman not installed.
 Watching for file changes with StatReloader
 Exception in thread Thread-1:
 Traceback (most recent call last):
   File "c:\tools\python\3.5\Lib\threading.py", line 914, in
 _bootstrap_inner
     self.run()
   File "c:\tools\python\3.5\Lib\threading.py", line 862, in run
     self._target(*self._args, **self._kwargs)
   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\site-
 packages\django\utils\autoreload.py", line 54, in wrapper
     fn(*args, **kwargs)
   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\site-
 packages\django\core\management\commands\runserver.py", line 116, in
 inner_run
     self.stdout.write("Performing system checks\u2026\n\n")
   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\site-
 packages\django\core\management\base.py", line 145, in write
     self._out.write(style_func(msg))
   File "C:\Users\davisda4\PythonEnvs\mplusmon\lib\encodings\cp437.py",
 line 19, in encode
     return codecs.charmap_encode(input,self.errors,encoding_map)[0]
 UnicodeEncodeError: 'charmap' codec can't encode character '\u2026' in
 position 24: character maps to <undefined>
 }}}

 A workaround is to change the code page to UTF-8, as follows:

 {{{
 chcp 65001
 }}}

 This appears to be a new issue relative to Django 2.1.7, because the
 problem did not occur there.    I'll track down wherever someone entered
 the horizontal elipsis character rather than "..." into the code, because
 this ought to be easy enough to fix.   Whomever did this was probably not
 even aware of it and it has worked well enough since almost all Django
 developers will use MacOS or Linux.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30184#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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.bb1a4da3c505ddb8b430e32f688e6261%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to