【发布时间】:2010-11-26 08:59:44
【问题描述】:
我编写了一个使用 pynotify 发出警报的脚本。当我运行它 (python script.py) 时它工作得很好,但是当使用 00 * * * * myname python ~/scripts/script.py 从 cron 运行时,它不起作用!我不知道为什么。这是sn-p:
if os.path.isfile(os.path.expanduser('~/.thumbnails/normal')+'/'+thumbnail):
n = pynotify.Notification(video_file[0], 'finished download', os.path.expanduser('~/.thumbnails')+'/'+thumbnail)
else:
n = pynotify.Notification(video_file[0], 'finished download', '/usr/share/icons/gnome/48x48/mimetypes/gnome-mime-application-x-shockwave-flash.png')
print n
n.show()
将输出定向到 ~/log.file 给出:<pynotify.Notification object at 0x16d4e60 (NotifyNotification at 0x13804e0)> 并且没有错误,所以我不太确定还能去哪里看。
【问题讨论】: