pydev console already ex

后端 未结 2 1743
南方客
南方客 2021-01-18 12:53

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

相关标签:
2条回答
  • 2021-01-18 12:54

    pip uninstall traitlets just worked for me.

    0 讨论(0)
  • 2021-01-18 13:10

    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.

    0 讨论(0)
提交回复
热议问题