Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kabc von Perl bzw. Python aus nutzen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Mon Mar 05, 2007 6:22 pm    Post subject: kabc von Perl bzw. Python aus nutzen Reply with quote

Mahlzeit :-)

Weiß einer von euch, wie man "richtig" auf die kaddressbook-Dateien mit Perl oder Python zugreifen kann? Ich hab ein paar Sachen gemacht, z. B. ein Perl-Script, was E-Mail-Adressen sammelt, wenn ich eine Mail an jemanden verschicke, der noch nicht in meinem Adreßbuch steht. Funktioniert zwar, ist aber eher quick-and-dirty, weil ich einfach nen kleinen Parser für das Adreßbuch geschrieben habe, der aber nur funktioniert, wenn es als Textdatei vorliegt. Und zwar als eine.
Ich würd das (und ein paar andere Sachen) gern "richtig" programmieren, weil ich denke, daß für sowas schon ein Bedarf bestünde ... aber die bisherige Lösung ist mir zu Hack-mäßig, um sie zu veröffentlichen. Ich wär echt froh über Tips :-)

MfG, Libby
Back to top
View user's profile Send private message
dakjo
Veteran
Veteran


Joined: 31 Jan 2004
Posts: 1544

PostPosted: Mon Mar 05, 2007 7:51 pm    Post subject: Reply with quote

Ich würde da eher mal im KDE Forum fragen.
Back to top
View user's profile Send private message
astaecker
Guru
Guru


Joined: 28 Apr 2003
Posts: 403
Location: Hamburg / Germany

PostPosted: Mon Mar 05, 2007 7:59 pm    Post subject: Reply with quote

Für Python gibt es PyKDE. Und da gibt es auch Klassen für KABC.
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Mon Mar 05, 2007 9:32 pm    Post subject: Reply with quote

Gibt's da irgendwo ein Beispiel, wie das funktioniert? Ich hab mir das schonmal vor längerer Zeit angeschaut, und ich hab's einfach nicht hingekriegt ...
Back to top
View user's profile Send private message
Fauli
l33t
l33t


Joined: 24 Apr 2004
Posts: 760
Location: Moers, Germany

PostPosted: Tue Mar 06, 2007 8:00 pm    Post subject: Reply with quote

Hier ein Miniprogrämmchen mit KABC:
Code:
#!/usr/bin/python
import sys
from kdecore import KApplication
from kabc import KABC
app = KApplication(sys.argv, "AddressbookApp")
stdab = KABC.StdAddressBook()
for address in stdab.allAddressees():
    print address.realName().latin1().decode("latin1")
del stdab

_________________
Do your part to beautify the web! Turn off link underlining!
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Wed Mar 07, 2007 2:32 pm    Post subject: Reply with quote

Funktioniert nicht :-(
Code:
Traceback (most recent call last):
  File "./kabc.py", line 4, in ?
    from kabc import KABC
  File "/home/tobias/bin-test/kabc.py", line 4, in ?
    from kabc import KABC
ImportError: cannot import name KABC
Back to top
View user's profile Send private message
Fauli
l33t
l33t


Joined: 24 Apr 2004
Posts: 760
Location: Moers, Germany

PostPosted: Wed Mar 07, 2007 6:08 pm    Post subject: Reply with quote

Welche Version von PyKDE hast du installiert? Ich habe hier dev-python/pykde-3.16.0.
_________________
Do your part to beautify the web! Turn off link underlining!
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Wed Mar 07, 2007 9:00 pm    Post subject: Reply with quote

Vorhin hab ich festgestellt, daß wohl scheinbar in kde-base/pykde keine kabc-Bindings drin sind. Seither versuche ich dev-python/pykde-3.16.10 zu installieren. Damit wird's ja wahrscheinlich gehen, aber ... seit drei Stunden starre ich auf eine Konsole, in der steht
Code:
i686-pc-linux-gnu-g++ -c -Wno-deprecated-declarations -pipe -fPIC -march=pentium4 -O2 -pipe -fno-strict-aliasing -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I. -I../extra/kde353 -I/usr/kde/3.5/include -I/usr/include/python2.4 -I/usr/qt/3/mkspecs/linux-g++ -I/usr/qt/3/include -I/usr/X11R6/include -o sipkdeuipart1.o sipkdeuipart1.cpp

Meine 512 MB RAM sind randvoll, und der Computer Swappt wie ein Weltmeister (~600 MB Swap). Kann's das geben, daß so ein paar popelige Python-Bindings DERART viel Arbeitsspeicher zumKompilieren brauchen?!
Back to top
View user's profile Send private message
Fauli
l33t
l33t


Joined: 24 Apr 2004
Posts: 760
Location: Moers, Germany

PostPosted: Wed Mar 07, 2007 9:49 pm    Post subject: Reply with quote

Mach mal ein:
Code:
MAKEOPTS="-j1" emerge dev-python/pykde

_________________
Do your part to beautify the web! Turn off link underlining!
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Wed Mar 07, 2007 10:27 pm    Post subject: Reply with quote

Hab ich probiert, danach ging's. ich hab auch nen Bugreport geschrieben ... scheint ein bekanntes Problem zu sein. Naja, zumindest klappt's jetzt mit dem KABC ;-)

EDIT:

Okay, ein bißchen bin ich jetzt dahintergestiegen, wie das läuft. mit KABC.StdAddressBook() kann ich auf den Inhalt sämtlicher Adreßbücher zurückgreifen. Aber wie kann ich auf ein bestimmtes zugreifen? Im konkreten Fall auf das, in dem dann die Adressen gesammelt werden sollen?

EDIT: Hab's hinbekommen ;-)
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Fri Mar 09, 2007 1:46 pm    Post subject: Reply with quote

Wen's interessiert: Das Endprodukt hab ich unter http://nasauber.de/downloads/kde/#collect_addresses online gestellt. Benötigt dev-python/pykde-3.16.0.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum