On Mon, Nov 21, 2005 at 05:33:22PM -0800, Robert Kleemann wrote:
> michael chang wrote:
> >perl scripts with the GIMP module can be loaded just like any
> >executable script; for example, if I have a script that uses GIMP
> >called myfile.pl and I go to that directory and call ./myfile.pl, it
> >will run.
> Thanks for the idea. I never thought of running the script as a
> stand-alone program which uses gimp as a library. This is exactly what
> I am looking for. I tried it with some code from one of my working
> python plugins. I removed the "register" code and inlined the relevant
> gimp calls.
<snip python script>
> Am I supposed to be able to call gimp from a standalone python program
> like this?
No, this does not work. Python-Fu scripts must be invoked from within
GIMP. I wish michael chang actually would check his facts once in a
while instead of posting wrong information.
The perl bindings do the run from the command line trick by having
GIMP run a plugin that listens on a socket for commands to evaluate. The
script will proxy over commands to the server. If no GIMP is running,
the script starts one up.
You could code up similar functionality for Python-Fu. I don't know your
skill level, but it wouldn't be too hard for someone with reasonable
Python and GIMP clue, and if done right, worthy of being folded into the
Another option is to code up a batch mode evaluator for python. Then you
could provide arbitrary code on standard input. This is less complex
to implement than the above.
You could write a simple proxy script that lives in the plugin dir that
imports your real script and runs it.
And finally, you could follow Carol's suggestion in her earlier mail,
that of defining another plug-in dir, and optionally selecting a
different config to only pull that in when you need it. This would
require no additional code at all.
Gimp-user mailing list