[Kde-pim] Segment fault tring to create akonadi resource in
Stephen Kelly
steveire at gmail.com
Wed Aug 17 12:56:00 BST 2011
Mario Santagiuliana wrote:
> In data 17/8/2011 12:24:31, Kevin Krammer ha scritto:
>> I think the problem is that you are missing the QApplication instance,
>> basically the first thing any Qt or KDE application creates in main.
>>
>> The main() function in C++ works a bit like this (simplified, the
>> original uses templates):
>>
>> int main( int argc, char **argv )
>> {
>> const QString id = parseArguments( argc, argv );
>> KApplication app;
>> ResourceClass* r = new ResourceClass( id );
>>
>> // check if ResourceClass also inherits AgentBase::Observer and
>> // if it does, automatically register it on itself
>> Observer *observer = dynamic_cast<Observer*>( r );
>> if ( observer != 0 )
>> r->registerObserver( observer );
>>
>> return init( r );
>> }
>>
>> So you could try the PyKDE equivalent of
>> KApplication app;
>> before creating the instance of your resource class.
>>
>> Cheers,
>> Kevin
>
> Kevin! Thank you very much for your help!
> In attachment I have a test python script without error...In this week I'm
> creating a test akonadi resource using python, I hope this work fine...
>
> Thank you very much!
I think fact that the Akonadi::Item class uses templates to get data in and
out will be a problem for you. I don't know what the python equivalent of
item.setPayload<KMime::Message::Ptr>(message);
and
message = item.payload<KMime::Message::Ptr>();
are.
I suspect it depends on the bindings, and I'm not aware of any work on the
python bindings to make that possible.
Thanks,
Steve.
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list