Search code examples
pythonserviceexternal

try start program from python script started as service


Created a service in the form of a python script in which VLC with a specific playlist should be started by command. Service plist:

<?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>

The ~/Library/LaunchAgents directory is missing in principle, so the service is located in the /Library/LaunchAgents directory. Service started normally, but: In this script I try to start the program (VLC with the parameter - playlist):

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

VLC tries to start and hangs, but in the log view error:

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.

Help me to understand...


Solution

  • I think you should use Console.app (Reveal it with Ctrl+Space) to discover more information about the hangs.

    More info about code -10810 can be found here: http://www.thexlab.com/faqs/error-10810.html

    More info about code -600 can be found here: https://discussions.apple.com/thread/1611175