. Advertisement .
..3..
. Advertisement .
..4..
How to solve the problem – oserror: [errno 48] address already in use? I have the sample detail:
python -m SimpleHTTPServer
While I was running it, I found the warning message:
socket.error: [Errno 48] Address already in use
That is my question in my midterm exam, and it is urgent. I searched the solutions for some websites, but I didn’t get it. I may miss any line or other changes. I appreciate your assistance!
The cause: A process is already linked to the default port (8000). If you’ve run the identical module before, the process is almost certainly still connected to the port.
Solution:
First, locate the other process:
If there are multiple
Python
processes running, the command arguments are supplied to help you identify the one that is runningSimpleHTTPServer
. Check ifhttp://localhost:8000/
still displays a directory listing for local files.Send a signal to the server to prevent it:
In case the process is unresponsive, you may have to resort to other methods like sending a
SIGKILL
(kill -s KILL <pid>
orkill -9 <pid>
) signal.Simple solution:
8080
to find the process:From step 1, the output of Step 1 is used to calculate PID.