This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Adding tags with python

Tags: None
(comma "," separated)
Yukarin
Registered Member
Posts
4
Karma
0
OS

Adding tags with python  Topic is solved

Sun Nov 03, 2013 10:14 am
Hi everyone!
Currently i'm learning python and tried add nepomuk tag for file.
I make script http://pastebin.com/FAiNiskD but when use it i get this:
Code: Select all
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
unnamed app(4017)/nepomuk (library) Nepomuk::ResourceData::store: "The name org.kde.nepomuk.DataManagement was not provided by any .service files"
unnamed app(4017)/nepomuk (library) Nepomuk::ResourceData::store: "The name org.kde.nepomuk.DataManagement was not provided by any .service files"
unnamed app(4017)/nepomuk (library) Nepomuk::ResourceData::setProperty: "The name org.kde.nepomuk.DataManagement was not provided by any .service files"

And tag not adding to file.

Also i found strange bug... If select file in dolphin and add tag with info panel (F11) - all working fine. But if select file, open properties (Alt+Return), go to Info tab and add tag here - nothing will change.
Maybe it has something to do with my error?
Sry for my bad english :<
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Adding tags with python

Mon Nov 04, 2013 6:26 am
Those error messages indicate the Nepomuk may not be running on your system - at least not fully.
Which version of KDE are you using?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Yukarin
Registered Member
Posts
4
Karma
0
OS

Re: Adding tags with python

Mon Nov 04, 2013 7:30 am
bcooksley wrote:Those error messages indicate the Nepomuk may not be running on your system - at least not fully.
Which version of KDE are you using?

I'm using arch linux and latest (kde-meta-kdebase) version of KDE - 4.11.2
This may be due to the fact that I turned off akonadi?
Yukarin
Registered Member
Posts
4
Karma
0
OS

Re: Adding tags with python

Mon Nov 04, 2013 8:07 am
Yukarin wrote:This may be due to the fact that I turned off akonadi?

Hmmm, i turned on akonadi but error still here...
Yukarin
Registered Member
Posts
4
Karma
0
OS

Re: Adding tags with python

Mon Nov 04, 2013 11:01 am
Well i test my script on other distro (latest kubuntu) and get same errors.
Also bug with adding tags in info panel still reproduce.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Adding tags with python

Thu Nov 07, 2013 9:16 am
I would recommend filing a bug in this case - it seems the API is not working as intended.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Ignacio Serantes
Registered Member
Posts
453
Karma
1
OS

Re: Adding tags with python

Thu Nov 07, 2013 10:01 am
You need a working event loop, try to add this line to your script.

Code: Select all
app = QCoreApplication(sys.argv)
or
Code: Select all
app = KApplication()


You could work with Nepomuk classes without problems using python but if you want working with Nepomuk2, recommended, you need other bindings not available in any distro. If you want examples you could check my programs Nepoogle, Neposidekick or Drop2TagIcon, all developed in Python.


Ignacio Serantes, proud to be a member of KDE forums since 2008-Nov.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell