Re: [Bug 677389] New: Can't use Gee in python
- From: Daniel Espinosa <esodan gmail com>
- To: Vala-list <vala-list gnome org>, gnome-db-list gnome org, gtk-app-devel-list <gtk-app-devel-list gnome org>, gtk list <gtk-list gnome org>
- Subject: Re: [Bug 677389] New: Can't use Gee in python
- Date: Mon, 11 Jun 2012 14:18:52 -0500
This is not just a problem focused on Gee/Python, is that I was using Gee in GDA to create an extension to access Data base objects and I would like to use the GObjects classes on Python to use GDA on the web. Then if I can't use Gee directly on Python then I can't use my GDA's extensions with Python too.
If Gee can't be used with GObject Introspection, no libraries can be created to develop other software depending on Gee.
May be some one else in gtk-list or gtk-app-devel-list can help to find how to use Vala's generics or construct generics classes on GObject-Introspection, at the end Gee C definitions have constructors defining the object type to use and some functions to create/free them.
2012/6/4 Maciej Marcin Piechotka
<uzytkownik2 gmail com>
Hi,
Unfortunately due to GNOME DB problems the bug was lost. I will try to
reply here.
On Sun, 2012-06-03 at 13:00 +0000, libgee wrote:
> I'm trying to use python to use Gee. Gee is primary a Vala library to
> be used on software written in Vala, but it defines GIR files, then it
> must be usable in any language supporting GObject Introspection.
>
Unfortunatly no. Libgee uses Vala generics which are not supported by
GIR. This will cause problem when marshalling/demarshalling python
objects.
> When try to define a new object in Python, like Gee.ArrayList, I can't
> because the following error:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.7/dist-packages/gi/module.py", line 243, in
> __getattr__
> return getattr(self._introspection_module, name)
> File "/usr/lib/python2.7/dist-packages/gi/module.py", line 180, in
> __getattr__
> wrapper = metaclass(name, bases, dict_)
> File "/usr/lib/python2.7/dist-packages/gi/types.py", line 232, in
> __init__
> register_interface_info(cls.__info__.get_g_type())
> TypeError: must be an interface
>
> By reading the code I found that most Gee's Interfaces are not defined
> GObject as pre-requisite, then I've added, then found that some other
> doesn't put interfaces definition inside a namespace clause. That
> doesn't make Vala compiler to rise errors and GIR are correct, but
> they must be correctly defined. I'll attach a patch to get your review
> and aprobation.
>
I believe that would be a Vala error while generating GIR as the
pre-requisite exists (indirectly). I don't think it is possible to write
Vala interface without this.
I am not sure what you mean by "GIR are correct, but they must be
correctly defined"
> But at the end found that Gee.Traversable is not defined in GIR
> repository. I'm trying to find it by:
>
> >>> Gee.Traversable
>
> I spect to get a pointer to an object defined in gir.repository.Gee,
but the following error was rised:
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.7/dist-packages/gi/module.py", line 243, in
> __getattr__
> return getattr(self._introspection_module, name)
> File "/usr/lib/python2.7/dist-packages/gi/module.py", line 105, in
> __getattr__
> self.__name__, name))
> AttributeError: 'gi.repository.Gee' object has no attribute
'Traversable'
>
> I'm reading the Gee.Traversable and GIR definition in order to find
the problem.
Thanks for looking into this. I am not sure how much time you have - it
would be great if vala and gir played nicely but it would require work
on both sides.
Best regards,
Maciej
--
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los cuates: LIBRE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]