Error 10013 HTTP Server

Solved
robjo82 -  
 robjo82 -
Hello,
I've been trying for a few days to create an HTTP server with Python, but when I run it, I get the following error:
Traceback (most recent call last):
File "http-server.py", line 12, in <module>
httpd = server(address, handler)
File "C:\Users\Robin\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 456, in __init__
self.server_bind()
File "C:\Users\Robin\AppData\Local\Programs\Python\Python36\lib\http\server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "C:\Users\Robin\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 470, in server_bind
self.socket.bind(self.server_address)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions


My code is as follows:
#coding:utf-8
import http.server

port = 80
address = ("", port)

server = http.server.HTTPServer

handler = http.server.CGIHTTPRequestHandler
handler.cgi_directories = ["/"]

httpd = server(address, handler)

print ("Server started on port", port)
httpd.serve_forever()


What should I do? Thank you in advance for your responses

Configuration: Windows / Chrome 71.0.3578.98

1 réponse

[Dal] Posted messages 6122 Registration date   Status Contributeur Last intervention   1 108
 
Hi robjo82,

I haven't looked at the details of your code, but try using port 8080 instead of 80, or any other port number that isn't already in use on your machine and is above 1024.

Dal
3
robjo82
 
It works, thank you very much!!!!!
0