Windows上的python:UnicodeDecodeError:“utf8”编解码器无法解码位置3中的字节0xb5:起始于无效

2024-03-29 12:28:04 发布

您现在位置:Python中文网/ 问答频道 /正文

Python 3.6.4
Windows10

我试图从url
加载json文件 但是,当我尝试
d3.json("http://ip_addr/field/parameters", function(error, data) { console.log(data) }

我有一个Access-Control-Allow-Origin错误。在

我尝试了一个解决方案
click here to see more detail
但是当我打字的时候

C:\Program Files (x86)\Google\Chrome\Application>python -m http.server 8888 &

我收到错误消息:
Traceback (most recent call last): File "C:\Users\xieda\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "C:\Users\xieda\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\xieda\AppData\Local\Programs\Python\Python36\lib\http\server.py", line 1211, in <module> test(HandlerClass=handler_class, port=args.port, bind=args.bind) File "C:\Users\xieda\AppData\Local\Programs\Python\Python36\lib\http\server.py", line 1185, in test with ServerClass(server_address, HandlerClass) as httpd: File "C:\Users\xieda\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 453, in __init__ self.server_bind() File "C:\Users\xieda\AppData\Local\Programs\Python\Python36\lib\http\server.py", line 138, in server_bind self.server_name = socket.getfqdn(host) File "C:\Users\xieda\AppData\Local\Programs\Python\Python36\lib\socket.py", line 673, in getfqdn hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 3: invalid start byte

我怎样才能解决这个问题?或者我的Access-Control-Allow-Origin错误有什么解决方案吗?在


Tags: inpyhttpserverbindliblocal错误