jbublitz at nwinternet.com
Sun Aug 1 22:45:01 BST 2004
On Sunday 01 August 2004 09:34, Lionel Roubeyrie wrote:
> Ok Jim, I use Sip 3 and now the import is good, but :
> >>> import kdesu
> >>> k=kdesu.KDEsuClient()
> Erreur de segmentation
> I don't understand how kdesu works or shall I have to switch to Sip4?
KDEsuClient is a dialog and can't be run without a KApplication instance,
meaning you can only run it from within a program, not from the interpreter.
However, the best I can get it to do within a program is return -1. Even if I
force PyKDE to pass it valid arguments (by modifying the PyKDE C++ code), the
KDE C++ kdesu lib 'exec' method (exec_ in Python) won't popup the dialog and
Since every error in the KDEsuClient C++ code returns -1, it's impossible to
tell which of about 20 different things is causing it to fail (although I'm
not getting a diagnostic back from KDE which might narrow it down).
The bottom line is that the kdesu module doesn't appear to work at present or
at least I don't know how to get it to work. The problem appears to on the
KDE (not PyKDE) side, so it's going to take quite a while to figure out what
the problem is. The PyKDE/sip machinery all appears to work correctly.
In the meantime, you can try using KPasswordEdit to get the password from the
user; I'm not sure how to validate the password from Python though. The
problem would be reading /etc/shadow.
The other alternative is to require the user to be root to start the program,
in which case you can run kdesu when invoking the program.
More information about the PyQt