Re: [Gimp-user] Python script query



On 11/09/2012 08:56 PM, Lorgach wrote:
Hi,

I’m trying to introduce myself to programming in Python for Gimp, however I’m having difficulty in trying to 
run some scripts and I’m hoping that some of the more knowledgeable members on the Forum will be able to give 
me some assistance.

In order to cut down on time, and also to gain experience I decided to modify some of the scripts that were 
written by experienced Python programmers to see what effects I could produce on various images.
However, I have found that when I make even minor changes to a script and save the changed script to the 
‘plug-ins’ folder under a new name, it will not show up in the Gimp Drop Down Menu specified in the script.
I would like to know if anyone else has come across this snag and, if so, what is the cause or if there is a 
solution.
Is there some kind of compiled code associated with a Python script when it has been saved under a ‘Name.py’ 
or when it has been run in Gimp that prevents it from being capable of being changed or edited.

I am using Gimp 2.8, Windows XP and the Komodo editor to make the changes.

Any help would be appreciated.


Python is very picky about indentation (tabs are not equivalent to spaces) so editing of working code by newcomers usually elicits syntax errors, and these errors make the plugin registration fail. They can be displayed using gimp-console but there is an even faster way: in a commant prompt, outside of Gimp, execute:

python the_plugin.py

The worst syntax errors will be displayed then. If you go as far as getting:

    from gimpfu import *
ImportError: No module named gimpfu

then the syntax is somewhat correct and you can expect the script to run enough to register.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]