Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pydev console already ex

Tags:

python

pydev

I get the following error code when trying to run an interactive python console in pydev

I can't figure out what is wrong. When I google about the

Console already exited with value: 1

part of the error, nothing useful comes up.

What is stranger is that this thing occurs in only one of my python workspace projects. Only one. And all other things are the same as in the others.

I want to add an image the question but it requires me over than 10 reputations.......

Error initializing console. Unexpected error connecting to console. Failed to recive suitable Hello response from pydevconsole. Last msg received: Console already exited with value: 1 while waiting for an answer.

like image 820
ggaemo Avatar asked Mar 17 '15 09:03

ggaemo


2 Answers

pip uninstall traitlets just worked for me.

like image 54
Ulf Rompe Avatar answered Nov 17 '22 20:11

Ulf Rompe


It seems (on my system; YMMV) to be an acknowledged bug where pydev isn't updated to match the API change from ipython version 4 to version 5.

Either do

pip uninstall ipython
pip install ipython==4.2.0

(hinted at in this answer), OR apply the following patch to pydev_ipython_console_011.py.

163c163
<                              self.has_readline)
---
>             )
171d170
<                              use_readline=self.has_readline,
183d181
<                              use_readline=self.has_readline,
194d191
<                              use_readline=self.has_readline,
239,245d235
< 
<         # Only configure readline if we truly are using readline.  IPython can
<         # do tab-completion over the network, in GUIs, etc, where readline
<         # itself may be absent
<         if self.has_readline:
<             self.set_readline_completer()
< 

Uninstalling traitlets allowed me to open the pydev console in eclipse, but broke ipython at the command line, so I reinstalled it. However, since the error message mentioned that some process was dying with exit code 1, I figured there might be a suppressed traceback worth seeing. So, I ran the mentioned command line

/usr/bin/python2.7 -u /home/tsbertalan/eclipse/cpp-mars/eclipse/../../../.p2/pool/plugins/org.python.pydev_4.5.4.201601292234/pysrc/pydevconsole.py 34462 35898 34462 35898

(which obviously depends on my specific installation), and got a traceback ending in

File "/home/tsbertalan/.p2/pool/plugins/org.python.pydev_4.5.4.201601292234/pysrc/_pydev_bundle/pydev_ipython_console_011.py", line 194, in _new_completer_200
    use_readline=self.has_readline,
AttributeError: 'PyDevTerminalInteractiveShell' object has no attribute 'has_readline'

When I googled the last line, I was led to this answer, where it's due to a changed API in ipython v5. So, it's a bug in pydev. I then checked their issue tracker and found it was already handled, and a workaround was to remove offending old API details (see patch above).

Unfortunately, the patch method only works for pydev 4.5.4. When I upgraded using Eclipse's "check for updates" function (in hopes that 5.1.3 would be available--only 5.1.2 was), the patch solved the immediate failure in that the interactive console started, with ipython, but using object? to print docstrings instead printed some sort of dictionary-like object. So, I'm now using pydev 5.1.2 with ipython 4.2.0. Maybe once I get 5.1.3 I'll try updating ipython.

like image 45
tsbertalan Avatar answered Nov 17 '22 21:11

tsbertalan