I am trying to start HTTPS server on my localhost, but getting below error. I have opened cmd as an administrator.
C:\Windows\system32>python -m SimpleHTTPServer
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\SimpleHTTPServer.py", line 224, in <module>
test()
File "C:\Python27\lib\SimpleHTTPServer.py", line 220, in test
BaseHTTPServer.test(HandlerClass, ServerClass)
File "C:\Python27\lib\BaseHTTPServer.py", line 595, in test
httpd = ServerClass(server_address, HandlerClass)
File "C:\Python27\lib\SocketServer.py", line 419, in __init__
self.server_bind()
File "C:\Python27\lib\BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "C:\Python27\lib\SocketServer.py", line 430, in server_bind
self.socket.bind(self.server_address)
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10013] An attempt was made to access a socket in a way forb
idden by its access permissions
asked Sep 21, 2014 at 5:02
garg10may
6,24812 gold badges59 silver badges98 bronze badges
-
Have you looked this up? There are a lot of results on the Google. I'm not going to close as duplicate because I don't know enough to make the judgement, but I'd expect you to at least point out how they don't apply when asking the question.Veedrac– Veedrac2014年09月21日 05:05:11 +00:00Commented Sep 21, 2014 at 5:05
-
Yes saw answers which discuss trying telnet, i get below error, C:\Windows\system32>telnet 127.0.0.1 80 'telnet' is not recognized as an internal or external command, operable program or batch file. Also changed from normal to admin account still same erorr, simultaneously reading over if something works.garg10may– garg10may2014年09月21日 05:08:53 +00:00Commented Sep 21, 2014 at 5:08
2 Answers 2
Your windows firewall may block python from listening. Additionaly, try adding a different port number higher than 1024 to the command line and see if it helps.
Sign up to request clarification or add additional context in comments.
3 Comments
falsetru
If unspecified,
SimpleHTTPServer uses port 8000.garg10may
Ok it started on port 2000, but how can I ensure if some process in running on 8000 and how do I stop that, does running on different port matters.
garg10may
@ApriOri is shows systemprocess with PID 4, firewall is definitely not blocking, since when I started on port 2000 it poped up and I allowed it.
I was not able to start since some service is already running on 8000, I was able to successfully start the service on another port 2000
C:\>python -m SimpleHTTPServer 2000
Serving HTTP on 0.0.0.0 port 2000 ..
One can get the PID/status for port 8000 by netstat -ano
C:\>netstat -ano
Active Connections
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 2544
TCP 0.0.0.0:8000 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:19781 0.0.0.0:0 LISTENING 3100
shows PID 4 which is a system process.
answered Sep 21, 2014 at 5:47
garg10may
6,24812 gold badges59 silver badges98 bronze badges
Comments
lang-py