简体   繁体   English

启动错误 - 加载失败:109:无效的属性列表 - 在尝试运行 python 脚本时 -

[英]launchd error - Load failed: 109: Invalid property list - whilst trying to run python script -

I'm trying to use launchd for the first time, I wish to automate some scripts.我是第一次尝试使用 launchd,我希望自动执行一些脚本。 When I try load my file I get the following error:当我尝试加载我的文件时,出现以下错误:

"Load failed: 109: Invalid property list" “加载失败:109:无效的属性列表”

Filename: com.test.daemon.plist文件名:com.test.daemon.plist

This is the command I'm entering into terminal:这是我进入终端的命令:

sudo launchctl load -w /Library/LaunchDaemons/com.test.daemon.plist sudo launchctl load -w /Library/LaunchDaemons/com.test.daemon.plist

Script:脚本:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>test.plist<</string>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/bin/python</string>
    <string>playground.py</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/Users/apollo/pycharm/pythonProject3</string>
    <key>StartInterval</key>
    <string>20</string>
    
</dict>
</plist>

What am I doing wrong?我究竟做错了什么?

I've bumped into the same error message when I was trying to setup a daemon for a Jenkins agent and it turned out I was using an invalid XML.当我尝试为 Jenkins 代理程序设置守护程序时,我遇到了同样的错误消息,结果发现我使用的是无效的 XML。

In your example, at line 6, the one after Label is incorrectly closed, has an extra < , which has to be removed.在您的示例中,在第 6 行, Label之后的那个被错误地关闭,有一个额外的< ,必须将其删除。 In addition, you may want to adjust the Label string to match with the launchd daemon name, ie.此外,您可能需要调整Label字符串以匹配 launchd 守护程序名称,即。 replace test.plist with com.test.daemon .test.plist替换为com.test.daemon

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM