简体   繁体   中英

How do I troubleshoot ipython-listener and/or gedit's ipython plugin?

I am running Gedit 3.8.3, Python 2.7.5+ and IPython 0.13.2 and the Gedit Ipython Plugin .

I know there are better IDEs for Python out there but this used to "just work" and then I got a new machine and installed Ubuntu 13.10 and it doesn't work anymore. The plugin used to give me an error, (gedit:23136): libpeas-WARNING **: Could not find loader 'python' for plugin 'ipython' but I followed some advice on AskUbuntu and edited the Loader line in /usr/lib/gedit/plugins/ipython.plugin to Loader=python3 and it now loads without error but also doens't do anything. Whether or not iPython-listener is running, the error I see in the console is

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

Is there a way to get this working?

Reposting as an answer:

The gedit IPython plugin appears to be written for Python 2 only, but it looks like it only takes a small change to adapt it to Python 3. Find the line on which the error occurred:

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

And change it to this:

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

UTF-8 should be the right default on most modern Linux systems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM