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()
Try changing the port to 8080. You didn't say which OS, but most UNIX derivatives will only allow root
to listen on ports below 1,024 or 4,096 depending on the OS and its configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With