Webkit2.javascriptresult.get_value() Throws Exception "typeerror: Couldn't Find Foreign Struct Converter For 'javascriptcore.value'".
Solution 1:
Unfortunately, using the JavaScriptCore library isn't supported in Python.
The definitions in gi.repository.JavaScriptCore
only include opaque definitions for JavaScriptCore.Value
and JavaScriptCore.GlobalContext
in order to provide type information for functions that use those types; as you can verify by looking in /usr/share/gir-1.0/JavaScriptCore-4.0.gir
. But as you've discovered, you can't actually call those functions because there's no information on how to convert those types to native Python objects.
I recommend writing a function in C which takes in your WebKit2.JavaScriptResult
and fetches whatever information you need from it, and then exporting that function in its own private GIR library. So you would not use any JavaScriptCore types in your Python code. This is what it might look like:
from gi.repository import MyAppPrivate
# ...defon_javascript_finish(obj, res):
result = obj.run_javascript_finish(res)
my_real_results = MyAppPrivate.process(result)
Post a Comment for "Webkit2.javascriptresult.get_value() Throws Exception "typeerror: Couldn't Find Foreign Struct Converter For 'javascriptcore.value'"."