4
我寫過一個腳本,它使用pynotify來提醒。它運行得很好,當我運行它時(python script.py
),但是從cron與00 * * * * myname python ~/scripts/script.py
運行時,它不起作用!我不知道爲什麼。這裏的片段:PyNotify無法從cron工作?
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)>
並沒有錯誤,所以我不太肯定別人看。
這是問題!謝謝! – 2010-11-26 01:12:55