Python Console crashes on startup in PyCharm

已回答

This all started when I was testing some code by entering it in the console. The console crashed, and now every time I try to use the console, it tries to execute that bad code and crashes right away. I've tried rebooting PyCharm and also rebooting my computer. Not sure what else to try.

 

Here is the traceback:

C:\Python27\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.2\helpers\pydev\pydevconsole.py" 59977 59978
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.2\helpers\pydev\pydevconsole.py", line 542, in <module>
pydevconsole.start_server(host, int(port), int(client_port), client_host)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.2\helpers\pydev\pydevconsole.py", line 362, in start_server
interpreter = InterpreterInterface(client_host, client_port, threading.currentThread())
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.2\helpers\pydev\_pydev_bundle\pydev_ipython_console.py", line 25, in __init__
self.interpreter = get_pydev_frontend(host, client_port, show_banner=show_banner)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.2\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 493, in get_pydev_frontend
_PyDevFrontEndContainer._instance = _PyDevFrontEnd(show_banner=show_banner)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.2\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 323, in __init__
self.ipython = PyDevTerminalInteractiveShell.instance()
File "C:\Python27\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:\Python27\lib\site-packages\IPython\terminal\interactiveshell.py", line 438, in __init__
super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 500, in __init__
self.init_io()
File "C:\Python27\lib\site-packages\IPython\terminal\interactiveshell.py", line 405, in init_io
self.enable_win_unicode_console()
File "C:\Python27\lib\site-packages\IPython\terminal\interactiveshell.py", line 379, in enable_win_unicode_console
import win_unicode_console
File "C:\Python27\lib\site-packages\win_unicode_console\__init__.py", line 2, in <module>
from . import streams, console, readline_hook
File "C:\Python27\lib\site-packages\win_unicode_console\readline_hook.py", line 14, in <module>
import pyreadline
File "C:\Python27\lib\site-packages\pyreadline\__init__.py", line 17, in <module>
from . import unicode_helper, logger, clipboard, lineeditor, modes, console
File "C:\Python27\lib\site-packages\pyreadline\console\__init__.py", line 15, in <module>
from .console import *
File "C:\Python27\lib\site-packages\pyreadline\console\console.py", line 147, in <module>
k32 = WinDLL('kernel32')
File "C:\Python27\lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be string, not unicode
Process finished with exit code 1



0

Hi! As a quick fix you can try "Invalidate Caches and Restart". Could you please tell us, which version of Python interpreter are you using?

0
Avatar
Permanently deleted user

Hi Elizabeth, thanks for the tip. Unfortunately it did not resolve the issue. I'm using Python 2.7.13

0

Could you please try to execute command:

import pyreadline

outside of PyCharm? Does it give the same error?

0
Avatar
Permanently deleted user

Thanks for the clue! I have it working again.

'import readline' failed outside of pycharm. I uninstalled this module and reinstalled using pip. This seems to have solved the issue. I still don't understand how this package got messed up, but at least it works now. Thanks for the support!

1

I'm happy to hear that! :)

0
Avatar
Permanently deleted user

Hello, I've come across with this issue when updating to the 2018 version. I've also tried to install / re-install pyreadline but it does not work.

0

Hi Aitor! Do you have exactly the same traceback?

0
Avatar
Permanently deleted user

This is the exact traceback I've received:

C:\Users\aitor.calero\Dropbox\PycharmProjects\ArcGISBox\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\pydevconsole.py" 64758 64759
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\pydevconsole.py", line 526, in <module>
    pydevconsole.start_server(host, int(port), int(client_port), client_host)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\pydevconsole.py", line 347, in start_server
    interpreter = InterpreterInterface(client_host, client_port, threading.currentThread())
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\_pydev_bundle\pydev_ipython_console.py", line 24, in __init__
    self.interpreter = get_pydev_frontend(host, client_port)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 461, in get_pydev_frontend
    _PyDevFrontEndContainer._instance = _PyDevFrontEnd()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 310, in __init__
    self.ipython = PyDevTerminalInteractiveShell.instance()
  File "C:\Users\aitor.calero\Dropbox\PycharmProjects\ArcGISBox\venv\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "C:\Users\aitor.calero\Dropbox\PycharmProjects\ArcGISBox\venv\lib\site-packages\IPython\terminal\interactiveshell.py", line 430, in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
  File "C:\Users\aitor.calero\Dropbox\PycharmProjects\ArcGISBox\venv\lib\site-packages\IPython\core\interactiveshell.py", line 516, in __init__
    self.init_completer()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 234, in init_completer
    self.Completer = self._new_completer_500()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 196, in _new_completer_500
    parent=self
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 87, in __init__
    self.matchers.remove(self.python_matches)
ValueError: list.remove(x): x not in list
Process finished with exit code 1
Couldn't connect to console process.
0

Hi Aitor Calero! This problem appears if you have IPython 6.3 installed on your interpreter: https://youtrack.jetbrains.com/issue/PY-29313. It's going to be fixed soon. As a temporary workaround, please, use another version of IPython (for example, 6.2)

1
Avatar
Permanently deleted user

Hello, so this seems to not have been fixed yet. I ran into the same problem with IPython 7.3 and had to reinstall to a previous version (6.2) before I was able to make it work.

0

Hi Christian,

I couldn't reproduce the issue on PyCharm 2018.3.4 with IPython 7.3.0

Are you sure that you're running the latest PyCharm version? Can you provide more detailed steps to reproduce the issue in your case?

0
Avatar
Permanently deleted user

Hi,

I have the same issue:

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\pydevconsole.py", line 517, in <module>
pydevconsole.start_server(host, int(port), int(client_port), client_host)
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\pydevconsole.py", line 338, in start_server
interpreter = InterpreterInterface(client_host, client_port, threading.currentThread())
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\_pydev_bundle\pydev_ipython_console.py", line 24, in __init__
self.interpreter = get_pydev_frontend(host, client_port)
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 494, in get_pydev_frontend
_PyDevFrontEndContainer._instance = _PyDevFrontEnd()
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 326, in __init__
self.ipython = PyDevTerminalInteractiveShell.instance()
File "C:\Users\aneves14\AppData\Local\conda\conda\envs\py36\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:\Users\aneves14\AppData\Local\conda\conda\envs\py36\lib\site-packages\IPython\terminal\interactiveshell.py", line 459, in __init__
super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
File "C:\Users\aneves14\AppData\Local\conda\conda\envs\py36\lib\site-packages\IPython\core\interactiveshell.py", line 676, in __init__
self.init_completer()
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 246, in init_completer
self.Completer = self._new_completer_500()
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 208, in _new_completer_500
parent=self
File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 89, in __init__
self.matchers.remove(self.python_matches)
ValueError: list.remove(x): x not in list
Process finished with exit code 1
Couldn't connect to console process.

 

My IPython version: 7.3.0

0

Hi Allana,

Please update to the latest PyCharm version if possible. I think it should be fixed there.

0
Avatar
Permanently deleted user

It did work! Thanks!

0
Avatar
Permanently deleted user

It really helped me too.

0

请先登录再写评论。