Python之Dijango的“坑” hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' cod
来源:互联网 发布:淘宝网连衣裙夏装 编辑:程序博客网 时间:2024/04/29 12:52
在命令行输入 python manage.py runserver启动服务器的时候,突然出现下面的错误
Traceback (most recent call last): File "learning.py", line 106, in <module> main() File "learning.py", line 37, in main httpd = make_server('127.0.0.1', PORT, application) File "D:\Program Files\Python34\lib\wsgiref\simple_server.py", line 153, in make_server server = server_class((host, port), handler_class) File "D:\Program Files\Python34\lib\socketserver.py", line 430, in __init__ self.server_bind() File "D:\Program Files\Python34\lib\wsgiref\simple_server.py", line 50, in server_bind HTTPServer.server_bind(self) File "D:\Program Files\Python34\lib\http\server.py", line 135, in server_bind self.server_name = socket.getfqdn(host) File "D:\Program Files\Python34\lib\socket.py", line 463, in getfqdn hostname, aliases, ipaddrs = gethostbyaddr(name)UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 0: invalidcontinuation byte
分析 :重点是最后一句红色的话,从中我们可以看出,是要得要你自己电脑的主机名,但是现在的主机名是中文,所以导致编码出现错误
解决方案:把你自己电脑的主机名改成英文的,不要写中文,然后重启电脑就可以了
注:你可以在python中的socket.py 中来看一下出错的地方
if not name or name == '0.0.0.0': name = gethostname()try: hostname, aliases, ipaddrs = gethostbyaddr(name)except error: passelse:
0 0
- Python之Dijango的“坑” hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' cod
- <param name="aliases"></param>拦截器的参数
- 解决Python的UnicodeDecodeError
- Python的UnicodeDecodeError错误
- Python UnicodeDecodeError 的解决办法
- python 之 utf-8编码的秘密
- python之UnicodeEncodeError,UnicodeDecodeError解决办法
- 解决python的UnicodeDecodeError问题
- python 的#-*-conding:utf-8-*- 和#encoding=utf-8
- aiohttp遇到非法字符的处理(UnicodeDecodeError: 'utf-8' codec can't decode bytes in position......)
- python之UTF-8解决方案
- python编码错误UnicodeDecodeError: 'ascii'/'utf-8' codec can't decode byte 0xb8 in position 50: ord
- python 网络爬虫报错“UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position”解决方案
- python编码错误UnicodeDecodeError: ‘ascii’/'utf-8′ codec can’t decode byte 0xb8 in position 50: ord
- 【CROC 2016 — QualificationC】【STL大联合】Hostname Aliases 输出拥有相同后缀集合的全体字符串
- [Python ]UnicodeDecodeError
- Python-UnicodeDecodeError
- spring配置文件中<bean>的id和name属性区别,以及identifier和aliases
- Moore's voting algorithm
- Java中对象交换的问题
- [leetcode]Kth Smallest Element in an Array
- 中国牛市
- css常用属性及属性值
- Python之Dijango的“坑” hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' cod
- pdo连接数据库及pdo对象的方法介绍
- linux下使用ffmpeg将flv、mp4、rmvb转换为libx264的mp4
- 剑指向offer-树的子结构-php
- MapReduce编程(七) 倒排索引构建
- C++指针
- A
- 算法训练 确定元音字母位置
- 通俗易懂的来讲讲DOM