Python Socket.Error: [Errno 98] Address Already In Use

11.8K    Asked by AlGerman in SQL Server , Asked on Nov 17, 2022

when I set up application.py, it shows oserror: [errno 98] address already in use

Traceback (most recent call last): File "application.py", line 121, in  main() File "application.py", line 117, in main http_server.listen(options.port) File "/usr/local/lib/python2.7/site-packages/tornado-3.1-py2.7.egg/tornado/tcpserver.py", line 117, in listen sockets = bind_sockets(port, address=address) File "/usr/local/lib/python2.7/site-packages/tornado-3.1-py2.7.egg/tornado/netutil.py", line 90, in bind_sockets sock.bind(sockaddr) File "/usr/local/ lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 98] Address already in use
Answered by Amit jaisawal
  Regarding the oserror: [errno 98] address already in use 

This happens because you trying to run service at the same port and there is an already running application. it can happen because your service is not stopped in the process stack. you just have to kill those processes. There is no need to install anything here is the one line command to kill all running python processes.

for Linux based OS:
Bash:
kill -9 $(ps -A | grep python | awk '{print $1}')
Fish:
kill -9 (ps -A | grep python | awk '{print $1}')


Your Answer

Interviews

Parent Categories