问题描述
我已经搜索了一段时间,但我要么找不到有同样问题的人,要么没有任何答案。
我的代码如下:
import socketserver
import http.server
import ssl
httpd = socketserver.Tcpserver(('0.0.0.0',10000),http.server.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,certfile="C:/Users/Server_https/server-public-key.pem",keyfile="C:/Users/Server_https/server-private-key.pem",server_side=True
)
httpd.serve_forever()
这很简单,适用于我的一位同志,但我个人收到此错误:
Traceback (most recent call last):
File "C:\Users\Server_https\https_server.py",line 7,in <module>
httpd.socket = ssl.wrap_socket(httpd.socket,File "C:\Program Files\python39\lib\ssl.py",line 1402,in wrap_socket
context.load_cert_chain(certfile,keyfile)
OSError: [Errno 9] Bad file descriptor
我使用的是 Python 3.9.1 和 Windows 10,有什么想法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)