UnicodeDecodeError:'utf-8'编解码器无法解码位置0的字节0xc4:无效的继续字节 [英] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 0: invalid continuation byte

查看:38
本文介绍了UnicodeDecodeError:'utf-8'编解码器无法解码位置0的字节0xc4:无效的继续字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我启动Django项目,迁移数据库,然后运行服务器进行测试.

I start my Django project, migrate my databases, and after there I run my server for testing.

如果我在Python的Django项目中运行服务器...

If I run the server in my Django project in Python...

(venv) C:\PR\djangogirls>manage.py runserver

Performing system checks...
System check identified no issues (0 silenced).
April 03, 2015 - 00:59:05
Django version 1.7.7, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK

我收到此错误:

System check identified no issues (0 silenced).
April 03, 2015 - 00:59:05
Django version 1.7.7, using settings 'mysite.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 0x00000000045897B8>
Traceback (most recent call last):
  File "C:\PR\djangogirls\venv\lib\site-packages\django\utils\autoreload.py", li
ne 222, in wrapper
    fn(*args, **kwargs)
  File "C:\PR\djangogirls\venv\lib\site-packages\django\core\management\commands
\runserver.py", line 134, in inner_run
    ipv6=self.use_ipv6, threading=threading)
  File "C:\PR\djangogirls\venv\lib\site-packages\django\core\servers\basehttp.py
", line 176, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\PR\djangogirls\venv\lib\site-packages\django\core\servers\basehttp.py
", line 117, in __init__
    super(WSGIServer, self).__init__(*args, **kwargs)
  File "C:\Python34\lib\socketserver.py", line 430, in __init__
    self.server_bind()
  File "C:\PR\djangogirls\venv\lib\site-packages\django\core\servers\basehttp.py
", line 121, in server_bind
    super(WSGIServer, self).server_bind()
  File "C:\Python34\lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "C:\Python34\lib\http\server.py", line 135, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Python34\lib\socket.py", line 464, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 0: invalid continuation byte

如何解决此错误?

推荐答案

您可以尝试通过笔记本打开源文件.选择文件编码:UTF-8.然后将文件另存为新文件.重新加载新文件您可以解决此错误.

You can try to open your source file by notebook.Choose the file coding:UTF-8.Then save your file as a new file.Reload the new file and you can fix this error.

这篇关于UnicodeDecodeError:'utf-8'编解码器无法解码位置0的字节0xc4:无效的继续字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆