From pykde Tue Jun 20 18:28:27 2006 From: Richard Heck Date: Tue, 20 Jun 2006 18:28:27 +0000 To: pykde Subject: Re: [PyKDE] DCOP From Cron Message-Id: <44983E4B.9070906 () comcast ! net> X-MARC-Message: https://marc.info/?l=pykde&m=115083016831166 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============2085511814==" This is a multi-part message in MIME format. --===============2085511814== Content-Type: multipart/alternative; boundary="------------010101090501000000080303" This is a multi-part message in MIME format. --------------010101090501000000080303 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Jim Bublitz wrote: > On Tuesday 20 June 2006 08:49, Richard Heck wrote: > >> İsmail Dönmez wrote: >> >>> Salı 20 Haziran 2006 17:19 tarihinde, Richard Heck şunları yazmıştı: >>> >>>> I'm writing a simple application to rotate wallpaper every so often, and >>>> I want to run it as a cron job. The basic structure is pretty simple, >>>> and it works fine if I run it in a shell under KDE. But when I run it as >>>> a cron job, it does not connect to the DCOP server. Is there some way to >>>> tell the script which DCOP server to connect to? >>>> >>> Maybe try dcop --user $username . >>> >> Sorry, that wasn't clear. The program I'm writing is in Python. >> > Yes, but it should be running under cron as the same user you're testing it as > (the user who owns the display and is running KDE). > > Your application should be based on KApplication, and can use > KApplication.dcopClient() to connect to the DCOP server. > Here is the relevant part of the application as it presently exists: #Create DCOP clients import kdecore import dcopext dcopclient = kdecore.KApplication.dcopClient() dcopclient.registerAs("changewp") dcopapp = dcopext.DCOPApp("kdesktop", dcopclient) and then later we have things like: dcopapp.KBackgroundIface.setWallpaper(...) As said, if I run this from a konsole under KDE, it works fine. But if I CTRL-ALT-F1 and open a terminal outside KDE, then it doesn't work, despite the fact that I'm running as the same user. Here's a simple test program: #/usr/bin/python #Create DCOP clients import kdecore import dcopext dcopclient = kdecore.KApplication.dcopClient() dcopclient.registerAs("changewp") dcopapp = dcopext.DCOPApp("kdesktop", dcopclient) print dcopapp.KBackgroundIface.currentWallpaper(1)[1] If I run that from a konsole, I get e.g. /usr/share/wallpapers/default_gears.jpg. But if I run it from a virtual terminal, I get: None. And again: I'm the same user both times. Richard Richard --------------010101090501000000080303 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Jim Bublitz wrote:
On Tuesday 20 June 2006 08:49, Richard Heck wrote:
  
İsmail Dönmez wrote:
    
Salı 20 Haziran 2006 17:19 tarihinde, Richard Heck şunları yazmıştı:
      
I'm writing a simple application to rotate wallpaper every so often, and
I want to run it as a cron job. The basic structure is pretty simple,
and it works fine if I run it in a shell under KDE. But when I run it as
a cron job, it does not connect to the DCOP server. Is there some way to
tell the script which DCOP server to connect to?
        
Maybe try dcop --user $username .
      
Sorry, that wasn't clear. The program I'm writing is in Python.
    
Yes, but it should be running under cron as the same user you're testing it as 
(the user who owns the display and is running KDE).

Your application should be based on KApplication, and can use 
KApplication.dcopClient() to connect to the DCOP server.
  
Here is the relevant part of the application as it presently exists:
#Create DCOP clients
import kdecore
import dcopext
dcopclient = kdecore.KApplication.dcopClient()
dcopclient.registerAs("changewp")
dcopapp = dcopext.DCOPApp("kdesktop", dcopclient)
and then later we have things like:
dcopapp.KBackgroundIface.setWallpaper(...)
As said, if I run this from a konsole under KDE, it works fine. But if I CTRL-ALT-F1 and open a terminal outside KDE, then it doesn't work, despite the fact that I'm running as the same user.

Here's a simple test program:
#/usr/bin/python
#Create DCOP clients
import kdecore
import dcopext
dcopclient = kdecore.KApplication.dcopClient()
dcopclient.registerAs("changewp")
dcopapp = dcopext.DCOPApp("kdesktop", dcopclient)
print dcopapp.KBackgroundIface.currentWallpaper(1)[1]
If I run that from a konsole, I get e.g. /usr/share/wallpapers/default_gears.jpg. But if I run it from a virtual terminal, I get: None. And again: I'm the same user both times.

Richard

Richard

--------------010101090501000000080303-- --===============2085511814== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde --===============2085511814==--