4

I have this code to create a webapp in my server:

import web

urls = (
    '/update', 'Update',
)

app = web.application(urls, globals())


class Update:

    print "hola"

if __name__=='__main__':
    app.run()

When I try to execute:

python@ubuntu:~$ python prueba.py 8081
hola
http://0.0.0.0:8081/
Traceback (most recent call last):
  File "prueba.py", line 21, in <module>
    app.run()
  File "/usr/local/lib/python2.6/dist-packages/web/application.py", line 311, in run
    return wsgi.runwsgi(self.wsgifunc(*middleware))
  File "/usr/local/lib/python2.6/dist-packages/web/wsgi.py", line 54, in runwsgi
    return httpserver.runsimple(func, validip(listget(sys.argv, 1, '')))
  File "/usr/local/lib/python2.6/dist-packages/web/httpserver.py", line 148, in runsimple
    server.start()
  File "/usr/local/lib/python2.6/dist-packages/web/wsgiserver/__init__.py", line 1753, in start
    raise socket.error(msg)
socket.error: No socket could be created

Why is it happening?

Thank you in advance

2
  • Added the web.py tag (since that's what you're using here). Hopefully now, one of those gurus will find this question. Commented Apr 9, 2012 at 14:20
  • possible duplicate of Running python app on localhost Commented Apr 9, 2012 at 14:26

1 Answer 1

3

The error message says that it couldn't create a listening socket on the specified port. Check if there is already a server running on port 8081.

Sign up to request clarification or add additional context in comments.

2 Comments

Nope, that would yield the error message [Errno 98] Address already in use
Oh my god! it was so easy! that was the mistake, thank you so much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.