Python Console starts with error message in PyCharm, not able to use it afterwards
Since some version I have the following error message in the Python console with my projects:
I am running Debian Testing:
/usr/bin/python2.7 /home/richard/apps/pycharm/helpers/pydev/pydevconsole.py 43565 37175
Python 2.7.12+ (default, Aug 4 2016, 20:04:34)
Type "copyright", "credits" or "license" for more information.
IPython 2.4.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
PyDev console: using IPython 2.4.1
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/richard/dev/qgis/git/timemanager'])
Python 2.7.12+ (default, Aug 4 2016, 20:04:34)
[GCC 6.1.1 20160724] on linux2
Traceback (most recent call last):
File "/home/richard/apps/pycharm/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 245, in add_exec
self.finish_exec(more)
File "/home/richard/apps/pycharm/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 438, in finish_exec
return server.NotifyFinished(more)
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1311, in single_request
self.send_content(h, request_body)
File "/usr/lib/python2.7/xmlrpclib.py", line 1459, in send_content
connection.endheaders(request_body)
File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 859, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 836, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
error: [Errno 111] Connection refused
I tried both normal python and ipython settings.
If I start pycharm from cmd I see the following:
richard@kwik~/apps/pycharm/bin$ ./pycharm.sh
[ 12109] WARN - napi.components.ServiceManager - com.jetbrains.python.console.PythonConsoleRunnerFactory requested as a service, but it is a component - convert it to a service or change call to ApplicationManager.getApplication().getComponent()
Any clue?
Regards,
Richard
请先登录再写评论。
Hi Richard! Do you have a firewall enabled on your system?
Hi Elizabeth,
nope, and I'm working from different working places (with and without corporate firewalls)
and I have not seen it work for some versions now.
Regards,
Richard
Hi I had the same problem as you. I solved the problem by making the line 127.0.0.1 localhost as the first line in /etc/hosts. The reason python console does not run is that python console tries to connect to localhost:pycharm-port, but localhost was resolved to the IPv6 addess of ::1, and the connection is refused.