python项目

Python项目

Flask

1、初次使用flask错误一

遇到以下错误时,通过分析最后一句错误原因,需要修改本地计算机名称,右键计算机–>属性–>更改计算机名为全英文,重启电脑,问题解决

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 ma
ke_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 ser
ver_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: invalid
continuation byte

也ython中的socket.py 中来看一下出错的地方

1
2
3
4
5
6
7
if not name or name ='0000':
name = gethostname()
try:
hostname,aliases,ipaddrs = gethostbyaddr(name)
except errot:
pass
else