#22658 closed Bug (worksforme)
Exception in Shell handler with unicode character on 1.7
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Internationalization | Version: | 1.7-beta-1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When attempting to execute command 'Le Désert' from django shell and error occurs and shell quits.
Steps to repo from
python manage.py shell
'>>>'Le Désert'
Traceback (most recent call last):
File "manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "[path_removed]/python2.7/site-packages/django/core/management/init.py", line 427, in execute_from_command_line
utility.execute()
File "[path_removed]/python2.7/site-packages/django/core/management/init.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "[path_removed]/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, options.dict)
File "[path_removed]/python2.7/site-packages/django/core/management/base.py", line 337, in execute
output = self.handle(*args, options)
File "[path_removed]/python2.7/site-packages/django/core/management/base.py", line 532, in handle
return self.handle_noargs(options)
File "[path_removed]/python2.7/site-packages/django/core/management/commands/shell.py", line 109, in handle_noargs
code.interact(local=imported_objects)
File "/usr/local/lib/python2.7/code.py", line 306, in interact
console.interact(banner)
File "/usr/local/lib/python2.7/code.py", line 238, in interact
line = line.decode(encoding)
File "/usr/local/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 5: invalid continuation byte
Django Versions tried: 1.7b1, 1.7b4
Change History (3)
comment:1 by , 10 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 10 years ago
Hi, I am also having this problem; can you offer a suggestion for how to get this fixed? The normal Python shell works fine, only manage.py shell breaks.
comment:3 by , 10 years ago
hi thanks for the reply -
However, normal python shell is working fine, this appears to be only happening in django shell.
See below that my shell works fine without django.
Am I missing some django configuration?
[rbenedum@rbpythondev app]$ /usr/local/bin/python2.7 Python 2.7.6 (default, Mar 31 2014, 18:28:33) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 'Le Désert' 'Le D\xe9sert' >>>
Here is a more complete dump of the previous error through django shell
[rbenedum@rbpythondev app]$ /usr/local/bin/python2.7 manage.py shell Python 2.7.6 (default, Mar 31 2014, 18:28:33) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> 'Le Désert' Traceback (most recent call last): File "manage.py", line 12, in <module> execute_from_command_line(sys.argv) File "/home/rbenedum/venv/e7e81f830beaf416aee8ababe202ee184aeb71df/lib/python2.7/site-packages/django/core/management/__init__.py", line 427, in execute_from_command_line utility.execute() File "/home/rbenedum/venv/e7e81f830beaf416aee8ababe202ee184aeb71df/lib/python2.7/site-packages/django/core/management/__init__.py", line 419, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/rbenedum/venv/e7e81f830beaf416aee8ababe202ee184aeb71df/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/home/rbenedum/venv/e7e81f830beaf416aee8ababe202ee184aeb71df/lib/python2.7/site-packages/django/core/management/base.py", line 337, in execute output = self.handle(*args, **options) File "/home/rbenedum/venv/e7e81f830beaf416aee8ababe202ee184aeb71df/lib/python2.7/site-packages/django/core/management/base.py", line 532, in handle return self.handle_noargs(**options) File "/home/rbenedum/venv/e7e81f830beaf416aee8ababe202ee184aeb71df/lib/python2.7/site-packages/django/core/management/commands/shell.py", line 109, in handle_noargs code.interact(local=imported_objects) File "/usr/local/lib/python2.7/code.py", line 306, in interact console.interact(banner) File "/usr/local/lib/python2.7/code.py", line 238, in interact line = line.decode(encoding) File "/usr/local/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 5: invalid continuation byte [rbenedum@rbpythondev app]$
This is running on CentOS 6.5 with custom compiled Python 2.7
Your shell appears not to be configured correctly — it doesn't pass input as utf-8.