如何解决ipython-listener和/或gedit的ipython插件问题?

时间:2013-12-21 02:20:08

标签: python ipython gedit gedit-plugin

我正在运行Gedit 3.8.3,Python 2.7.5+和IPython 0.13.2以及Gedit Ipython Plugin

我知道有更好的用于Python的IDE,但这曾经“只是工作”然后我得到了一台新机器并安装了Ubuntu 13.10并且它不再起作用了。该插件曾经给我一个错误,(gedit:23136): libpeas-WARNING **: Could not find loader 'python' for plugin 'ipython',但我跟着some advice on AskUbuntu并将/usr/lib/gedit/plugins/ipython.plugin中的Loader行编辑为Loader=python3,现在加载时没有错误但也没有任何事情。无论iPython-listener是否正在运行,我在控制台中看到的错误都是

Traceback (most recent call last):
  File "/usr/lib/gedit/plugins/ipython.py", line 98, in send_to_ipython
    self.socket.sendto(code, (self.listener_host, self.listener_port) )     
TypeError: 'str' does not support the buffer interface

有没有办法让这个工作?

1 个答案:

答案 0 :(得分:0)

重新作为答案:

gedit IPython插件似乎只是为Python 2编写的,但看起来只需要做一些小改动就可以使它适应Python 3.找到发生错误的行:

self.socket.sendto(code, (self.listener_host, self.listener_port) )

并改为:

self.socket.sendto(code.encode('utf-8'), (self.listener_host, self.listener_port) )

在大多数现代Linux系统上,UTF-8应该是正确的默认设置。