Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
plugin help: not appearing in gimp

What's wrong with this code and why does it not appear in GIMP?
What needs to be changed to make it work?

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
from gimpfu import*

def test(timg, tdrawable):

   print_to_stderr("Hello World")

def print_to_stderr(*a):

   print(*a, file=sys.stderr)

Using tabs and not spaces?

(As a gimp/python newbie who suffered for several days with scripts randomly appearing and disappearing from the menu, and also not realising comments need to be indented too)
Which is why the first thing to do is to run the script in  command prompt outside of Gimp (yes, it' easier to do on Linux/OSX, but it can also be done in Windows):

Bad code, will definitely not run when Gimp tries to make it register:
 File "", line 40
IndentationError: unexpected indent

Worth trying (doesn't mean there are zero errors, but these will show when the script is used):
Traceback (most recent call last):
 File "", line 5, in <module>
   from gimpfu import *
ImportError: No module named gimpfu
This is also why it is important to use an adequate editor, that won't try to "help".

Forum Jump: