RSS/Atom feed Twitter
Site is read-only, email is disabled

using a parasite in a python import/export script

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

using a parasite in a python import/export script Lucas Beyer 21 Oct 16:32
  using a parasite in a python import/export script Rob Antonishen 21 Oct 16:55
   using a parasite in a python import/export script Lucas Beyer 21 Oct 19:32
Lucas Beyer
2009-10-21 16:32:45 UTC (about 15 years ago)

using a parasite in a python import/export script

Hello,

If this is the wrong list for my question, please tell me the right place for it.

I wrote an exporter script (to a new file format) in python. This script requires the user to choose the location of some other file, amongst other settings before saving the image
so in the call to the register function, there is the following: (PF_BOOL, "compression", _("Use _compression (LZO, not yet implemented)"), True),
(PF_FILE, "ftsarc", _("The ftsarc binary"), "/some/path/to/some/file")

Once the user selected that file, I would like to keep that setting in mind to avoid him the need to re-select it, as it is very likely to never change. I could do this by saving it into a well-defined file, like ~/.something, but that sucks (I don't like to pollute the filesystem).

I found that the png exporter plugin uses "parasites" for this, that sounds interesting. Now, trying to read my parasite is a problem, I need to read it before the call to register but at that time, the GIMP system doesn't seem to be ready yet. Just doing:
print gimp.parasite_list()
in the script will print out the error: LibGimpBase-ERROR **: gimp_wire_write_msg: the wire protocol has not been initialized
aborting...
(gimp:17350): LibGimpBase-WARNING **: gimp: gimp_wire_read(): error to the console.

Is there any other way to achieve what I want? (Without saving it to a well-defined file in the user's home)

Rob Antonishen
2009-10-21 16:55:56 UTC (about 15 years ago)

using a parasite in a python import/export script

I found that the png exporter plugin uses "parasites" for this, that sounds interesting. Now, trying to read my parasite is a problem, I need to read it before the call to register but at that time, the GIMP system doesn't seem to be ready yet. Just doing:
        print gimp.parasite_list()
in the script will print out the error:         LibGimpBase-ERROR **: gimp_wire_write_msg: the wire protocol has not been initialized
        aborting...
        (gimp:17350): LibGimpBase-WARNING **: gimp: gimp_wire_read(): error to the console.

Is there any other way to achieve what I want? (Without saving it to a well-defined file in the user's home)

Works for me. Here is a capture from my python console:

GIMP 2.6.4 Python Console Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]

print gimp.parasite_list()

('exif-orientation-rotate', 'testing', 'jpeg-save-defaults')

Lucas Beyer
2009-10-21 19:32:30 UTC (about 15 years ago)

using a parasite in a python import/export script

Works for me. Here is a capture from my python console:

GIMP 2.6.4 Python Console Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]

print gimp.parasite_list()

('exif-orientation-rotate', 'testing', 'jpeg-save-defaults')

Yes, in the python-console it works like a charm, I tested it there.

The problem is with the python scripts that get loaded during GIMP startup (i.e. scripts in ~/.gimp-2.4/plug-ins), it seems they are loaded even before some GIMP core.

Oh, if it may help, here are my versions: Gimp 2.4.5 Python Console
Python 2.5.2 (r252:60911, Dec 1 2008, 18:10:01) [GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]]