On Mon, Sep 2, 2013 at 3:28 PM, <anntzer....@gmail.com> wrote: > On Sunday, September 1, 2013 2:03:56 PM UTC-7, Chris Angelico wrote: > >> > I tried using netifaces (https://pypi.python.org/pypi/netifaces) which >> > seems to rely on getifaddrs (according to the doc, I didn't check the >> > source). Again, it returns nearly instantaneously the correct IP address. >> >> Perfect! >> >> ChrisA > > Not really for my use case -- it isn't that *I* want to know my public IP > address, but rather that IPython wants to know it. Of course I could patch > IPython's source to use netifaces but that sounds like an overkill. > > As it happens I found a better way: just add the proper entry to /etc/hosts.
Ah, I see what you mean. If it were possible with core Python, I would recommend raising a bug with IPython, as the current method is susceptible to external issues. But to just get your problem solved, yes, a host file entry sounds like it's the best way to go. ChrisA -- http://mail.python.org/mailman/listinfo/python-list