Question

I'm running pylons and I did this: paster server development.ini It's running on :5000

But when I try to run the command again: paster serve development.ini

I get this message: socket.error: [Errno 98] Address already in use

Any ideas?

Was it helpful?

Solution

Normally that means it's still running, but that should only happen if it's in daemon mode. After you started it, do you get a command prompt, or do you have to stop it with Ctrl-C?

If you get a command prompt back it's deamon mode and you have to stop it with

paster server development.ini stop

If you have stopped it with Ctrl-C (and not Ctrl-Z of course), I have no idea.

OTHER TIPS

I've found this trick in a forum:

This will kill all programs listening to port 5000

kill -9 `fuser -n tcp 5000`

As I understand your question, you start some application to listen on port 5000. Then without stopping it (?), you try to start another instance to listen on het same port? If so, you won't succeed.

You can always check what application is listening on what port number by using netstat (for both Windows and UNIX-like systems, I have no experience with others).

This has also happened to me when the server died unexpectedly, and didn't close it's socket's properly. Essentially, the socket is still listed as open with the operating system, even though the process has died. I've found if I wait for 30-60 seconds, the OS will realize the associated process has died, and cleanup the sockets automatically.

your default port 8080 is using. you should add '-p 10000' after command to take port 10000

naturally netstat (netstat -an | grep 5000 does the trick on linux). Will grab the port

However I found this other question with the same error.

Python [Errno 98] Address already in use

sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

Essentially Python takes too long to open the socket.

I tried all the upvoted answers exists here but no one works for me. But this below command does the trick.

sudo kill $(sudo lsof -t -i:5000)

This would kill the process which listens on the port 5000.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top