You are not logged in.

#1 2011-01-02 15:48:53

Urfaust
Member
From: Germany
Registered: 2009-01-30
Posts: 164

Gedit Plugin - betterpythonconsole does not work anymore

Hi,

today I noticed that the betterpythonconsole-plugin does not work anymore. After hitting F5 in gedit (which should open a python-console and execute the code opened with gedit) I get the following error:

 File "/usr/lib/gedit-2/plugins/betterpythonconsole/consoleinterface.py", line 92
    def seek(self, a):   raise IOError, (29, 'Illegal seek')
                                      ^
SyntaxError: invalid syntax

Problem is I can't remember how I installed this plugin. It is not in the gedit-plugins package and gedit-plugins-extra was removed from community, maybe I installed this manually....Should I file a bug report in the arch bug tracker or upstream or what?

Offline

#2 2011-01-02 23:46:29

Stunts
Member
From: Portugal
Registered: 2009-03-28
Posts: 339
Website

Re: Gedit Plugin - betterpythonconsole does not work anymore

I'd say this is related to python3.
Just edit "/usr/lib/gedit-2/plugins/betterpythonconsole/consoleinterface.py" and on the first line replace "#!/usr/bin/python" with "#!/usr/bin/python2".
Oh, and make sure you have python2 installed too.
Hope that helps.

Offline

#3 2011-01-03 20:38:46

Urfaust
Member
From: Germany
Registered: 2009-01-30
Posts: 164

Re: Gedit Plugin - betterpythonconsole does not work anymore

Unfortunately that does not fix it. :-( Same error as before. But thanks for your reply.
So I think I will open a bug report on the arch bugtracker.

EDIT: https://bugs.archlinux.org/task/22297

Last edited by Urfaust (2011-01-03 21:31:00)

Offline

#4 2011-01-03 21:40:37

Stunts
Member
From: Portugal
Registered: 2009-03-28
Posts: 339
Website

Re: Gedit Plugin - betterpythonconsole does not work anymore

Too bad it didn't work out...
But I think you should report the bug to the authors of the plugin, if that's not it, it doesn't seem to be arch related.
Keep us posted tough.

Edit: Ninja'ed - Guess Inout Biru already told you that...

Last edited by Stunts (2011-01-03 21:42:09)

Offline

#5 2011-01-05 17:10:41

Urfaust
Member
From: Germany
Registered: 2009-01-30
Posts: 164

Re: Gedit Plugin - betterpythonconsole does not work anymore

https://bugzilla.gnome.org/show_bug.cgi?id=638756

Last edited by Urfaust (2011-01-05 18:12:36)

Offline

#6 2011-01-05 20:34:31

Stunts
Member
From: Portugal
Registered: 2009-03-28
Posts: 339
Website

Re: Gedit Plugin - betterpythonconsole does not work anymore

Offline

#7 2011-01-06 17:49:08

Urfaust
Member
From: Germany
Registered: 2009-01-30
Posts: 164

Re: Gedit Plugin - betterpythonconsole does not work anymore

Yeah, I didn't noticed that this is a third-party plugin. :facepalm: roll

But I have some progress now: the code of the plugin is outdated, so I changed it to the new python syntax (print() instead of print, exec() instead of exec and so on). Now I get another error smile:

Traceback (most recent call last):
  File "/usr/lib/gedit-2/plugins/betterpythonconsole/consoleinterface.py", line 57, in <module>
    import pygtk
ImportError: No module named pygtk

All packages are installed:
python2 2.7.1-3
python 3.1.3-1
pygtk 2.22.0-3
gtk 1.2.10-10

and the shebang of consoleinterface.py is #!/usr/bin/python2

Also:

>python2
Python 2.7.1 (r271:86832, Dec 20 2010, 11:54:29) 
[GCC 4.5.1 20101125 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>> 

works, but

>python
Python 3.1.3 (r313:86834, Dec  1 2010, 12:16:07) 
[GCC 4.5.1 20101125 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pygtk
>>> 

doesn't.

I will look into this later. I'm a total python n00b so if you have an idea...:D Maybe I can learn something by fixing it myself. wink

Last edited by Urfaust (2011-01-06 17:53:23)

Offline

#8 2011-01-06 18:48:22

Stunts
Member
From: Portugal
Registered: 2009-03-28
Posts: 339
Website

Re: Gedit Plugin - betterpythonconsole does not work anymore

After installing the plugin myself, I have realized that gedit is still using python3 to load the plugins.
This is set in the plugin loader file.
Changing "Loader=python" to "Loader=python2" should solve the issue, but gedit doesn't recognize python2.
You may have to hack gedit's source code...
Maybe someone more experienced can give an opinion?

Offline

#9 2011-01-06 19:51:36

Urfaust
Member
From: Germany
Registered: 2009-01-30
Posts: 164

Re: Gedit Plugin - betterpythonconsole does not work anymore

yikes
Thanks for pointing that out!

Offline

Board footer

Powered by FluxBB