Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripts do not appear in menu
#1
Hi, i'm using Gimp 2.10 on ubuntu-based linux.

I'm trying to follow this guide on how to get started with GIMP scripting, but when I save the .py file in the scripts folder or the plug-ins folders nothing happens.

When I restart GIMP I don't see the option to run that script in the menu.
I've also tried downloading other scripts from the internet, put them in the scripts folder and plug-ins folder, and same thing, they don't appear in the menu.


Am I doing something wrong?
This is the script's code, which I copied from the tutorial:


Code:
#!/usr/bin/python

from gimpfu import *

def first_plugin(timg, tdrawable):
 print "Hello, world!"

register(
 "hello_world",
 "Presents a Hello, World! message",
 "Presents a Hello, World! message",
 "Brad Jones",
 "Brad Jones",
 "2017",
 "<Image>/Image/Hello, World!",
 "RGB*, GRAY*",
 [],
 [],
 first_plugin)

main()


It's from 2017, so maybe it's not compatible anymore?

Thanks for the help guys.
Reply
#2
Run gimp from a terminal, with verbose mode, you should have some infos about the issue:

Code:
$ gimp --verbose
Reply
#3
It seems to work for me:
   

BUT note that python scripts must go into plug-ins AND on Linux they must be marked as executable
Reply
#4
(02-04-2021, 02:26 PM)tmanni Wrote: Run gimp from a terminal, with verbose mode, you should have some infos about the issue:

Code:
$ gimp --verbose

Thanks, I managed to get some more info:

This Hello World plugin terminates like this:
Code:
Querying plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/hello_world.py'
gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error
Terminating plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/hello_world.py'

The other plugin that I got from the internet does this instead:

Code:
Querying plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/ofn-preset-guides.py'
/usr/bin/env: ‘python’: No such file or directory
gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error
Terminating plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/ofn-preset-guides.py'


I'm not very familiar with programming, just the bases, but does this mean that i'm missing some Python package or library?
Does anybody know how to fix it?

Thanks!
Reply
#5
First, ensure your script files have "execution" permission:

Code:
$ chmod +x /home/mq/.config/GIMP/2.10/plug-ins/hello_world.py
$ chmod +x /home/mq/.config/GIMP/2.10/plug-ins/ofn-preset-guides.py
Reply
#6
(02-04-2021, 03:04 PM)tmanni Wrote: First, ensure your script files have "execution" permission:

Code:
$ chmod +x /home/mq/.config/GIMP/2.10/plug-ins/hello_world.py
$ chmod +x /home/mq/.config/GIMP/2.10/plug-ins/ofn-preset-guides.py

Thank you. They already had permission, but I run the commands anyways.

However I get the same results:

Code:
Querying plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/ofn-preset-guides.py'
/usr/bin/env: ‘python’: No such file or directory
gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error
Terminating plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/ofn-preset-guides.py'
Querying plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/hello_world.py'
gimp: LibGimpBase-WARNING: gimp: gimp_wire_read(): error
Terminating plug-in: '/home/mq/.config/GIMP/2.10/plug-ins/hello_world.py'


Intuitively, the cause of the error might be in this line:

Code:
/usr/bin/env: ‘python’: No such file or directory


But I really don't know, I'm no expert.
Do you have any idea?

Again, thank you very much
Reply
#7
You need to have

1. Python v2 installed (so that the shebang #! /usr/bin/env python serves its purpose)
2. The Python support installed in Gimp. It used to be a gimp-python package, but since Ubuntu 20.04 it's no longer there.  See here for a fix.
Reply
#8
Are the native python plugins provided by gimp working as expected ?
You can try with Export Histogram:
1) run gimp from terminal with --verbose
2) load or import an image
3) menu Colors > Info > Export Histogram...
Reply
#9
I see Ofnuts post and confirm.
Using (k)ubuntu 18.04  A bit strange, In a Gimp 2.10 14 the script works OOTB but a Gimp 2.10.22 appimage, different (older) python 2.7 version required a shebang #!/usr/bin/env python As Kevin test work here.

   

@ MQ95 Which version of 'buntu and Gimp 2.10?   If 'buntu 20.04 then python support for Gimp 2.10 is not included.  Look in the Filters menu for the Python-fu entry.
It can be added see:  https://www.gimp-forum.net/Thread-Heal-S...4#pid18354

Alternatives: Use the Gimp flatpak version or Use a Gimp Appimage both include a working python 2.7
Reply
#10
(02-04-2021, 03:41 PM)Ofnuts Wrote: You need to have

1. Python v2 installed (so that the shebang #! /usr/bin/env python serves its purpose)
2. The Python support installed in Gimp. It used to be a gimp-python package, but since Ubuntu 20.04 it's no longer there.  See here for a fix.

Thanks, I tried that but some file links gave me a 404, and some .deb I downloaded couldn't be installed because of dependency issues.

(02-04-2021, 03:54 PM)rich2005 Wrote: I see Ofnuts post and confirm.
Using (k)ubuntu 18.04  A bit strange, In a Gimp 2.10 14 the script works OOTB but a Gimp 2.10.22 appimage, different (older) python 2.7 version required a shebang #!/usr/bin/env python As Kevin test work here.



@ MQ95 Which version of 'buntu and Gimp 2.10?   If 'buntu 20.04 then python support for Gimp 2.10 is not included.  Look in the Filters menu for the Python-fu entry.
It can be added see:  https://www.gimp-forum.net/Thread-Heal-S...4#pid18354

Alternatives: Use the Gimp flatpak version or Use a Gimp Appimage both include a working python 2.7

Solved!
I installed the flatpak, and it works correctly now.
It's just a bit of a mess since flatpak isn't supported by default by Kubuntu

I'm on Kubuntu 20.10 by the way (latest version)
That maybe the problem.

Thanks to everyone who helped!
Reply


Forum Jump: