zuijiawoniu / pythonxy

Automatically exported from code.google.com/p/pythonxy
0 stars 0 forks source link

Unable to start IPython or Spyder when no network connection available #713

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If relevant, please answer to the following questions:
1. What version of Python(x,y) have you installed?
2.7.5.2

2. Which components have you installed (Python(x,y) installer:
componentpage):
    a. Have you selected the "Recommended" component selection?
yes
    b. Have you selected the "Full" component selection?
no
c. Have you selected manually plugins in the component list?
Whatplugins?
yes (winpdb, opencv, pywavelet)

3. Have you selected the option "Customize installation directories"?
b. No

5. Where did you install Python(x,y) itself?
a. default path

6. Have you installed Python(x,y):
    b. For "All users"

7. What is your operating system?
    c. Windows 8

8. Is the operating system 64 bit?
a. Yes

9. When you installed Python(x,y), were you logged in as :
b. an administrator of the machine

10. If you are using Windows Vista/7, have you installed Python(x,y):
a. simply by double-clicking on the installer

11. Regarding installed software on your machine, how did you clean your
machine before installing Python(x,y)  (multiple answers are possible):
a. you didn't do anything, you installed Python(x,y) directly on your
machine without precaution

What steps will reproduce the problem?
1. Unplug network cable, disconnect from wifi
2. Run 'spyder' or try to open an IPython prompt
3. Wait forever

What is the expected output? What do you see instead?
Program should start normally

Please provide any additional information below.
I traced the problem using winpdb, and it boils down to 
ipython/utils/localinterfaces.py 
program gets stuck on the following code block:
try:
     hostname = socket.gethostname()
     PUBLIC_IPS = socket.gethostbyname_ex(hostname)[2]
     # try hostname.local, in case hostname has been short-circuited to loopback
     if not hostname.endswith('.local') and all(ip.startswith('127') for ip in PUBLIC_IPS):
         PUBLIC_IPS = socket.gethostbyname_ex(socket.gethostname() + '.local')[2] # <-- this is the 'wait forever' line when no network can be reached
 except socket.error:
[...]

I worked around the problem by adding an entry in my 'hosts' for my hostname 
(=entropy):
127.0.0.1 entropy.local
this solved the problem.

If you check IPython 2 development on github, this file has been rewritten (and 
I understand why)... 

Original issue reported on code.google.com by nicolas.aspert on 13 Jan 2014 at 3:29

GoogleCodeExporter commented 9 years ago
IPython was updated to 2.1.0 - cannot reproduce with that version.

Original comment by grizzly.nyo on 28 May 2014 at 8:23