What causes Python socket error?

2019-02-04 16:46发布

问题:

  File "C:\Python25\lib\SocketServer.py", line 330, in __init__
    self.server_bind()
  File "C:\Python25\lib\BaseHTTPServer.py", line 101, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "C:\Python25\lib\SocketServer.py", line 341, in server_bind
    self.socket.bind(self.server_address)
  File "<string>", line 1, in bind
socket.error: (10013, 'Permission denied')

I tried to start up the Google App Engine development server and received this error the first time I tried to run it. Any ideas? I'm new to python.

回答1:

It might be possible that you are trying to run on a port the current user account does not have permission to bind to. This could be port 80 or something. Try increasing the portnumber or use a user with sufficient privileges.

Hope this helps



回答2:

I wonder why the error is not "Port already in use". I kind of know the answer but I should not need to use SO to know it. :) – Oscar Reyes May 13 at 19:09

The port is not in use, (in UNIX) you need to be superuser to listen on any port < 1024.



回答3:

I am assuming your are using the default port assigned by gae sdk so you might want to ensure that it is not used by any other programs.



回答4:

run it as follow. This should work

python -m 8888

if this does not work. Try other numbers like 8080.