Re: How to call WebKit.DOMDocument.evaluate function in python
- From: Niranjan Rao <nhrdls gmail com>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: How to call WebKit.DOMDocument.evaluate function in python
- Date: Tue, 02 Jul 2013 10:35:53 -0700
Thanks for the information. I had came across the webkit bug you mentioned.
And yes, I had tried creating empty WebKit.DOMXPathResult object and
passing it. Did not work.
As much as I hate this, I see only following options for me now. As much
as I would have loved it, only python based solution may not be possible.
1. Write my own c extension - pain to distribute, need to worry about
lot of things or user needs to build it.
2. Switch to another language where this works - e.g. java
3. Try using "internal" variables and see if it works. If not, back to
square one again :(
I have logged a bug against Webkit GTK team also.
Regards,
Niranjan
On 07/02/2013 04:58 AM, Simon Feltman wrote:
Hi,
On Mon, Jul 1, 2013 at 11:48 PM, Niranjan Rao <nhrdls gmail com
<mailto:nhrdls gmail com>> wrote:
I need to perform some DOM operations once the document is loaded.
Webkit
DOMDocument provides evaluate method which can allow me to reach
to element
using xpath, if it works. The parameter DOMXPathResult of the
evaluate
method has annotations declared in such a way that null/None value in
python can not be used. However null value in this case is legal and
accepted.
It looks like the introspection bindings are missing (allow-none) for
the parameter. The bindings seem to be generated by a perl script and
a quick web search revieled a related problem here:
https://bugs.webkit.org/show_bug.cgi?id=42115
You should probably log a bug against WebKit Gtk to get the annotation
fixed. Also, have you tried creating an empty WebKit.DOMXPathResult
and passing that?
>>> res = WebKit.DOMXPathResult()
Is there any way to get underlying gobject pointer from python so
that I
can use ctypes and try to call function directly. So far my
attempts have
resulted in coredump as webkit is asserting on various values I am
sending
to it.
Later versions of PyGObject give access to the internal GObject
pointer through the "__gpointer__" attribute on wrapped objects. But
it is unclear if this would be useful in ctypes because it returns a
PyCapsule. This attribute is used internally for some parts of
PyGObject. However, we cannot support this officially as it is an
implementation detail, so use at your own risk.
You should also be able to create a small C extension to Python which
wraps the function up for you.
-Simon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]