Problem with helloworld - socket.gaierror: (-2, 'Name or service not known')

74 views
Skip to first unread message

harijay

unread,
Jun 10, 2008, 7:09:15 PM6/10/08
to Google App Engine
Hi I downloaded the zip file and went through the helloworld example.
However when I try to run the simple example I get the following error
( see below) . I am looking to start playing with app-engine. ANy
ideas why I get this error.
Any help will be much appreciated
harijay


hari@localhost ~ $ google_appengine/dev_appserver.py helloworld/
INFO 2008-06-10 19:06:58,962 appcfg.py] Server:
appengine.google.com
INFO 2008-06-10 19:06:58,983 appcfg.py] Checking for updates to
the SDK.
INFO 2008-06-10 19:06:59,111 appcfg.py] The SDK is up to date.
WARNING 2008-06-10 19:06:59,111 datastore_file_stub.py] Could not
read datastore data from /tmp/dev_appserver.datastore
WARNING 2008-06-10 19:06:59,112 datastore_file_stub.py] Could not
read datastore data from /tmp/dev_appserver.datastore.history
Traceback (most recent call last):
File "google_appengine/dev_appserver.py", line 50, in <module>
execfile(script_path, globals())
File "/home/hari/google_appengine/google/appengine/tools/
dev_appserver_main.py", line 351, in <module>
sys.exit(main(sys.argv))
File "/home/hari/google_appengine/google/appengine/tools/
dev_appserver_main.py", line 330, in main
require_indexes=require_indexes)
File "/home/hari/google_appengine/google/appengine/tools/
dev_appserver.py", line 2645, in CreateServer
return BaseHTTPServer.HTTPServer((serve_address, port),
handler_class)
File "/usr/lib/python2.5/SocketServer.py", line 330, in __init__
self.server_bind()
File "/usr/lib/python2.5/BaseHTTPServer.py", line 101, in
server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.5/SocketServer.py", line 341, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.gaierror: (-2, 'Name or service not known')


I contents of the helloworld.py are
hari@localhost ~ $ vi helloworld/helloworld.py
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'

And the app.yaml file has

hari@localhost ~ $ vi helloworld/app.yaml
application: helloworld
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: helloworld.py

harijay

unread,
Jun 11, 2008, 8:59:05 AM6/11/08
to Google App Engine
I Solved this problem- but I dont understand why the solution worked-
If anyone can shed light on this that will be much appreciated

Symptom:
File "/usr/lib/python2.5/SocketServer.py", line 341, in server_bind
> self.socket.bind(self.server_address)
> File "<string>", line 1, in bind
> socket.gaierror: (-2, 'Name or service not known')


Solution
I had a faulty entry in my /etc/hosts file
127.0.0.1 transcode.homelinux.org
Instead of
127.0.0.1 localhost

I now have the following entries
127.0.0.1 localhost
::1 localhost
192.168.1.155 transcode.homelinux.org transcode

And now the dev_appserver connects fine .

Thought I would post this here so it helps someone else-
Harijay

Nicolas Chauvat

unread,
Jun 11, 2008, 1:48:07 PM6/11/08
to google-a...@googlegroups.com
On Wed, Jun 11, 2008 at 05:59:05AM -0700, harijay wrote:
> File "/usr/lib/python2.5/SocketServer.py", line 341, in server_bind
> > self.socket.bind(self.server_address)
> > File "<string>", line 1, in bind
> > socket.gaierror: (-2, 'Name or service not known')
> ...

> I had a faulty entry in my /etc/hosts file
> 127.0.0.1 transcode.homelinux.org
> Instead of
> 127.0.0.1 localhost

if self.server_address == 'localhost' and name localhost can not be
resolved, there is no way for the socket to find what IP address it is
supposed to bind to.

Reply all
Reply to author
Forward
0 new messages