pythongnomepygobjectgnumeric

Gnumeric Python plugin : service file_opener and file_saver


Is it possible to write a gnumeric python plugin for the file_opener and file_saver service?

It seems implemented in the python-loader plugin, there are corresponding sections in the Gnome documentation.

But the example plugin gnome-glossary, which is python file_saver plugin, raises an error ImportError: No module named gsf and I can't write in the output object given by the API:

def so_file_save(wb, output):
    output.props.write("toto")

produces the error :

Exception Python (<type 'exceptions.AttributeError'> : 'gobject.GProps' object has no attribute 'write')

And this gobject.GProps object claim to be of __gtype__ : GsfOutputStdio


Solution

  • The python bindings for 'libgsf' are unsupported since a long time ago. As you can read in the old README-python:

    I wrote these bindings in 2002, and they haven't been updated since. They were never part of a standard build, but it was possible to build them by following the instructions below. It will probably take some work to make them work with current versions of autotools and pygobject. Bindings would have to be revalidated, and extended to match the current API of libgsf.

    I do not plan to do further work on these bindings. If anybody wants to pick them up, please feel free.

    Jon K Hellan [...] 2006-02-24

    That explaines why gnome-glossary fails. Also, it seems to be a problem with the parameter output, which is shown as a GObject, but not as GsfOutputStdio (you only can see the properties, but you do not have access to any method.

    This is not the solution you are looking for, but an attempt of explanation of what you are seeing.