简体   繁体   中英

PermissionError: [Errno 13] Permission denied Python

Hi I am trying to create a web server with python but I am getting an error message PermissionError: [Errno 13] Permission denied

This is my code:

import os, sys 
from http.server import HTTPServer, CGIHTTPRequestHandler

webdir = '.'
port = 80

os.chdir(webdir)
srvaddr = ('', port)
srvobj = HTTPServer(srvaddr, CGIHTTPRequestHandler)
srvobj.serve_forever()

尝试将端口更改为8080.您没有说明哪个操作系统,但大多数UNIX衍生产品只允许root用户监听1,024或4,096以下的端口,具体取决于操作系统及其配置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM