i execute python2.6 app/sipd.py -d and got an error

38 views
Skip to first unread message

王永涛

unread,
Oct 26, 2012, 6:34:59 AM10/26/12
to myproje...@googlegroups.com
Hi, dear friend:

Error Info:


Traceback (most recent call last): 
  File "app/sipd.py", line 60, in <module> agent = sipapi.Agent(listen=[(y, x[0], x[1]) for x, y in zip(hostports, options.transport)]) 
  File "/home/p2p-sip/src/app/sipapi.py", line 118, in __init__
    t = TransportInfo(sock)
  File "/home/p2p-sip/src/std/rfc2361.py", line647, in __init__
    addr = getlocaladdr(sock)
  File "/home/p2p-sip/src/stc/kutil.py", line 66, in getlocaladdr
    addr=(_local_ip if _local_ip else socket.gethostbyname(socket.gethostname()), addr[1])
socket.gaierror: [Errno -2] Name or service not known

Thanks.

Intencity Team

unread,
Oct 26, 2012, 6:29:30 PM10/26/12
to myproje...@googlegroups.com, gggy...@gmail.com
Hi,

The error means that your hostname is not correctly configured.
On unix/mac-os-x you can run the following commands to know your hostname.

$ hostname

Then you can make sure that this points to the correct hostname that
is configured in your /etc/hosts file or resolvable using DNS.

Another work-around is to supply the -l option to sipd.py with the
specific IP address of your machine. Suppose your IP address is
192.168.1.5 then use the following

$ python2.6 app/sipd.py -d -l 192.168.1.5:5060

This will force it to use that IP address instead of trying to derive
it using gethostbyname(gethostname()) call.

Hope this helps!
> --
> You received this message because you are subscribed to the Google
> Groups "myprojectguide" group.
> To post to this group, send email to myproje...@googlegroups.com
> To unsubscribe from this group, send email to
> myprojectguid...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/myprojectguide?hl=en



--
The Intencity Team http://theintencity.com

王永涛

unread,
Oct 26, 2012, 10:33:28 PM10/26/12
to myproje...@googlegroups.com, gggy...@gmail.com
it works.thanks so much!!

在 2012年10月27日星期六UTC+8上午6时29分31秒,Intencity Cloud Technologies写道:

Thatcher Peskens

unread,
Aug 17, 2016, 2:15:21 AM8/17/16
to myprojectguide, gggy...@gmail.com


Hmm. 


While I understand that this problem can be fixed by setting a correct hostname, it is not very user friendly to just fail like this. I reckon most mac and windows users will not have their machine name mapped to an IP address in their /etc/hosts file, and so a lot of people will first waste some time finding the cause of this error and fixing it.


Would you be interested in a patch which catches this error, spits out a warning that your hostname doesn't resolve and then quits? 


socket.gaierror: [Errno 8] nodename nor servname provided, or not known



best,
Thatcher

ps. Also; would it not be a good idea to open the issues feature on GitHub? I think that would be a great place to put these kinds of issues (and their ways to resolve / workaround)
Reply all
Reply to author
Forward
0 new messages