[Pythonmac-SIG] appscript and launching apps from "background-only" Python processes
Ned Deily
nad at acm.org
Wed Oct 29 03:15:44 CET 2008
In article <11040.1225240345 at parc.com>, Bill Janssen <janssen at parc.com>
wrote:
> I'm starting a Python daemon using SystemStarter, and in it I'm using
> appscript to launch an app (Entourage). I get the following error:
>
> CantLaunchApplicationError: CantLaunchApplicationError -606: Application is
> background-only.
>
> If I start the same daemon from the command-line manually, it works
> fine. I'm guessing that some environment variable is not being set by
> SystemStarter, which is what makes it "background-only". Can anyone
> shed some light on this?
I suspect the issue is that processes started by SystemStarter are not
"connected" to the windowserver and are running as root so attempts to
launch Carbon or Cocoa gui apps will fail. Tech note 2083 has a lot of
details about this and the perils of launching gui apps from daemons:
<http://developer.apple.com/technotes/tn2005/tn2083.html>
Also note that in 10.4, Apple introduced launchd which is intended to
replace the various startup mechanisms including SystemStarter. launchd
includes the capability to define system-wide as well as per-user
LaunchAgents (triggered by various conditions) and LaunchDaemons. Peter
Borg has written a nifty free app, Lingon, to simplify the creating and
editing of launchd plists.
<http://tuppis.com/lingon/>
HTH
--
Ned Deily,
nad at acm.org
More information about the Pythonmac-SIG
mailing list