2017-03-09 67 views
0

以python腳本的形式創建服務,其中應使用命令啓動具有特定播放列表的VLC。 服務的plist:嘗試從作爲服務啓動的python腳本啓動程序

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$ 
<plist version="1.0"> 
<dict> 
    <key>Label</key> 
    <string>com.bioxakep.biobot.plist</string> 
    <key>Program</key> 
    <string>/Users/BioMac/Documents/Scripts/newHome.py</string> 
    <key>KeepAlive</key> 
    <true/> 
    <key>StandardOutPath</key> 
    <string>/tmp/biobot.out</string> 
    <key>StandardErrorPath</key> 
    <string>/tmp/biobot.err</string> 
</dict> 
</plist> 

〜/庫/ LaunchAgents目錄中缺少原則,因此該服務位於/庫/ LaunchAgents目錄。 服務正常啓動,但: 在這個劇本我嘗試啓動程序(VLC與參數 - 播放列表):

os.system('open -a vlc /Users/BioMac/Desktop/Radio.m3u') 

VLC嘗試啓動和掛起,但在日誌中查看錯誤:

LSOpenURLsWithRole() failed for the application /Aplplications/VLC.app with error -600 for the file /Users/BioMac/Desktop/Radio.m3u. 
LSOpenURLsWithRole() failed for the application /Aplplications/VLC.app with error -10810 for the file /Users/BioMac/Desktop/Radio.m3u. 

幫助我明白了...

回答