I'm running Pycharm 4.5.3 on OS X Yosemite (10.10.3). I created a simple python program, and tried opening the python console, and got this stack trace error:
/usr/bin/python -u /Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py 59286 59287
Error starting server with host: localhost, port: 59286, client_port: 59287
Unhandled exception in thread started by <function start_server at 0x100d9bd70>
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 283, in start_server
server = XMLRPCServer((host, port), logRequests=False, allow_none=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SimpleXMLRPCServer.py", line 593, in __init__
SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 419, in __init__
self.server_bind()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 430, in server_bind
self.socket.bind(self.server_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
Couldn't connect to console process.
A similar question was raised here on stack overflow, but the root of the error was the string localhost passed in with white spaces, which is not the case here (host has been assigned to 'localhost'). Does anyone have any idea? This isn't really a big deal, seeing as I can use python command line in terminal, but I'm curious if this is a bug within Pycharm.
Edit: here's the source code to the Pycharm script.
if __name__ == '__main__':
import pydevconsole
sys.stdin = pydevconsole.BaseStdIn()
port, client_port = sys.argv[1:3]
import pydev_localhost
if int(port) == 0 and int(client_port) == 0:
(h, p) = pydev_localhost.get_socket_name()
client_port = p
pydevconsole.StartServer(pydev_localhost.get_localhost(), int(port), int(client_port))
The answers given so far do not get at the underlying cause, which is likely to be that your OS X /etc/hosts
file does not contain an entry for: 127.0.0.1 localhost
Update the hosts file with the line: 127.0.0.1 localhost
(you will need to use sudo), then restart pyCharm. Unless you know what you are doing, editing your IDE source code is not a good idea.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments