[Geany-Devel] Python question

Lex Trotman elextr at xxxxx
Sat Apr 26 20:48:35 UTC 2014

On 27 April 2014 03:43, Pavel Roschin <roshin at scriptumplus.ru> wrote:
>> Another (untested) hack that might work:
>>    def geanypy_path():
>>      import geany, os
>>      path = os.path.dirname(
>>        os.path.dirname(os.path.dirname(geany.__file__)))
>>      return os.path.join(path, "geanypy.so")
>> Cheers,
>> Matthew Brush
> It works good too, but as I mentioned above, casting doc to correct pointer
> isn't simple in Python (and I have no ideas how to).

You have to define a structure type that matches what the pointer
points to https://docs.python.org/2/library/ctypes.html#structures-and-unions
and then cast the doc pointer to that
https://docs.python.org/2/library/ctypes.html#type-conversions and
then you should be able to access the fields.


> --
> Best regards,
> Pavel Roschin aka RPG
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel

More information about the Devel mailing list