亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

gethostbyaddr在Python3中引發(fā)UnicodeDecodeError

 更新時間:2022年05月20日 16:32:17   作者:python?django  
本文介紹了gethostbyaddr()在Python?3中引發(fā)UnicodeDecodeError的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧

問題描述

我正在用Python 3.4.1來構建一個Django項目。

 manage.py runserver 引發(fā)UnicodeDecodeException。

如何解決?

查看以下(修剪)追溯:

追溯(最近的最后一次呼叫):

文件C:\ Python34\lib\socketserver.py,第429行__init__  self.server_bind()

文件C:\Python34\lib\site-packages\django\core \servers\basehttp.py,第121行,在server_bind 超級(WSGIServer,self).server_bind()

文件C:\Python34\lib\wsgiref \simple_server.py,第50行,server_bind  HTTPServer.server_bind(self)

文件C:\Python34\lib\http\server.py,第135行, server_bind  self.server_name = socket.getfqdn(host)

文件C:\Python34\lib\socket.py,第460行,getfqdn 主機名,別名,ipaddrs = gethostbyaddr(name)

UnicodeDecodeError:'utf-8'編解碼器無法解碼位置12中的0xcf字節(jié)無效連續(xù)字節(jié) 

每個請求,我的主機名:

 C:\Users\AnatoliyVik>主機名 AnatoliyVik-ПК 

解決方案

將主機名更改為不再包含西里爾字符解決問題。

感謝@拉法達的指導。

I'm trying to build a Django project with Python 3.4.1. manage.py runserver raises a UnicodeDecodeException.

How can this be resolved? See the below (trimmed) traceback:

Traceback (most recent call last):
  File "C:\Python34\lib\socketserver.py", line 429, in __init__
    self.server_bind()
  File "C:\Python34\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 460, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 12: invalid
 continuation byte

Per request, my hostname:

C:\Users\AnatoliyVik>hostname
AnatoliyVik-ПК

Changing the hostname to no longer include Cyrillic symbols resolves the problem.

Thanks to @Lafada for the guidance.

這篇關于gethostbyaddr()在Python 3中引發(fā)UnicodeDecodeError的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持腳本之家!

相關文章

最新評論