[Pythonmac-SIG] py-appscript problem in crontab

tom wible airdrummer at wheel.org
Wed Feb 27 23:49:35 CET 2008


just wrote a script to kill live eyetv:

#! /usr/bin/env python
from appscript import *
app(u'/Applications/EyeTV.app').window[its.name.startswith('EyeTV')].close()

and it works great fom the cli, but not in crontab:

Subject: Cron <dvr at wiblesdvr> /DVR/scripts/noLiveEyeTV.py
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=dvr>
X-Cron-Env: <USER=dvr>
X-Cron-Env: <HOME=/Users/dvr>
Date: Wed, 27 Feb 2008 01:01:02 -0500 (EST)

Traceback (most recent call last):
   File "/DVR/scripts/noLiveEyeTV.py", line 3, in ?
     app(u'/Applications/EyeTV.app').window[its.name.startswith('EyeTV')].close()
   File 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aeosa/appscript/reference.py", 
line 523, in __getitem__
     return Reference(self.AS_appdata, self.AS_aemreference.byfilter(
   File 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aeosa/appscript/genericreference.py", 
line 63, in AS_resolve
     ref = getattr(ref, args)
   File 
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/aeosa/appscript/reference.py", 
line 511, in __getattr__
     raise AttributeError, "Unknown property, element or command: %r" % name
AttributeError: Unknown property, element or command: 'startswith'

obviously a path problem:
wiblesdvr:~ dvr$ ls -l `which python`
lrwxr-xr-x   1 root  admin  9 Jun  9  2007 
/Library/Frameworks/Python.framework/Versions/Current/bin/python -> python2.5
wiblesdvr:~ dvr$ echo $PATH
/Library/Frameworks/Python.framework/Versions/Current/bin:/bin:/sbin:/usr/bin:/usr/sbin

and crontab's python:
wiblesdvr:~ dvr$ export PATH=/usr/bin:/bin
wiblesdvr:~ dvr$ ls -l `which python`
lrwxr-xr-x   1 root  wheel  9 Jul 24  2006 /usr/bin/python -> python2.3
wiblesdvr:~ dvr$ ls -l /usr/bin/py*
-rwxr-xr-x   1 root  wheel     44 Jan 13  2006 /usr/bin/pydoc
lrwxr-xr-x   1 root  wheel      9 Jul 24  2006 /usr/bin/python -> python2.3
lrwxr-xr-x   1 root  wheel     72 Jul 24  2006 /usr/bin/python2.3 -> 
../../System/Library/Frameworks/Python.framework/Versions/2.3/bin/python
lrwxr-xr-x   1 root  wheel     10 Jul 24  2006 /usr/bin/pythonw -> pythonw2.3
-rwxr-xr-x   1 root  wheel  34216 Jan 13  2006 /usr/bin/pythonw2.3

so how come /System/Library/Frameworks/Python.framework/Versions/Current is 
different from /Library/Frameworks/Python.framework/Versions/Current?

should i fix that, or will that break other stuff?
tia


More information about the Pythonmac-SIG mailing list