尝试加载.plist文件时出现“无此类文件或目录”错误

2024-06-28 09:51:18 发布

您现在位置:Python中文网/ 问答频道 /正文

你好:

我正在尝试从“库”下的LaunchDaemons目录加载以下.plist文件。我想在每个星期天晚上11:59执行我的[可执行文件]

当我在终端中键入以下内容时:

 launchctl load ~/Library/[username]/local.emailfriend.plist

它给我的错误是“没有这样的文件或目录”

硬件:MacBookPro 可执行文件:一个.py文件,我使用pyinstaller--onefile[filename.py]将其转换为可执行文件

My.plist文件:

<?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>local.emailfriend</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/[myusername]/Documents/[executablefilename]</string>
        </array>
        <key>StartCalendarInterval</key>
            <key>Hour</key>
            <integer>11</integer>
            <key>Minute</key>
            <integer>59</integer>
            <key>Weekday</key>
            <integer>7</integer>
    </dict>
</plist>

请注意,我的plist文件已保存到我的库下的LaunchDaemons文件夹中。 任何帮助都将不胜感激!多谢各位