Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

python - Unicodedecodeerror with runserver

After setting up all what django requires, I tried the runserver command and I caught an error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 8: invalid continuation byte

From:

c:sue>python manage.py runserver
Validating models...

0 errors found
April 16, 2014 - 15:02:42
Django version 1.6.2, using settings 'sue.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000000003890048>
Traceback (most recent call last):
  File "C:python34libsite-packagesdjangoutilsautoreload.py", line 93, in wrapper fn(*args, **kwargs)
  File "C:python34libsite-packagesdjangocoremanagementcommands
unserver.py", line 127, in inner_run ipv6=self.use_ipv6, threading=threading)
  File "C:python34libsite-packagesdjangocoreserversasehttp.py", line 167, in run httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:python34libsite-packagesdjangocoreserversasehttp.py", line 109, in __init__ super(WSGIServer, self).__init__(*args, **kwargs)
  File "C:python34libsocketserver.py", line 430, in __init__ self.server_bind()
  File "C:python34libsite-packagesdjangocoreserversasehttp.py", line 113, in server_bind super(WSGIServer, self).server_bind()
  File "C:python34libwsgirefsimple_server.py", line 50, in server_bind HTTPServer.server_bind(self)
  File "C:python34libhttpserver.py", line 137, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:python34libsocket.py", line 460, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 8: invalid continuation byte

I am using Windows 7 x64, python 3.4 and django 1.6.2. What does this error mean?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This sounds like this Python issue. If your computer name has non-ASCII characters this will fail. You may:

  1. Issue the runserver command with explicit host and port: python manage.py runserver 127.0.0.1:8000
  2. Change your computer name to a string that only contains ASCII characters.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...